Skip to content

Commit

Permalink
fetch api endpoint should return a json object
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjibansg committed Jul 5, 2023
1 parent 437d3f9 commit 78df1fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ async def FetchPlan(id: str, db: MongoDBConnection = Depends(get_mongo_conn)):
response = await db.get_record(id)
if response is None:
raise HTTPException(status_code=404, detail="Plan not found")
return response["json_data"], response["validator_overrides"]
return {
"json_data": response["json_data"],
"validator_overrides": response["validator_overrides"],
}


# For defining custom documentation for the server
Expand Down
4 changes: 2 additions & 2 deletions client/src/views/CodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default {
},
async loadPlan(id) {
const resp = await getPlan(id);
const jsonObject = JSON.parse(resp.data[0]);
const jsonObject = JSON.parse(resp.data.json_data);
this.code = JSON.stringify(jsonObject, null, 2);
this.language = "json";
Expand All @@ -172,7 +172,7 @@ export default {
models[0].setValue(this.code);
this.clearValidationOverrideLevel();
resp.data[1].forEach((value) => {
resp.data.validator_overrides.forEach((value) => {
this.addValidationOverrideLevel(value);
});
},
Expand Down

0 comments on commit 78df1fb

Please sign in to comment.