Skip to content

Commit

Permalink
fix(#20): set returning status of View API to 200
Browse files Browse the repository at this point in the history
  • Loading branch information
sametcodes committed Mar 8, 2023
1 parent 261c54e commit 1f63d85
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion services/api/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ const handlePlatformAPI: PlatformAPIHandler = (
config
);

if (result.success === false)
if (result.success === false) {
return res.status(result.status).json({ message: result.error });
}

res.setHeader("Content-Type", result.contentType || "image/svg+xml");
res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate=59");
return res.status(result.status).send(result.data);
};
};
Expand Down
18 changes: 14 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -21,7 +25,9 @@
],
"baseUrl": ".",
"paths": {
"@/*": ["*"]
"@/*": [
"*"
]
}
},
"include": [
Expand All @@ -36,11 +42,15 @@
".next/types/**/*.ts",
"/Users/samet/Documents/GitHub/devstats/.next/types/**/*.ts"
],
"exclude": ["node_modules"],
"exclude": [
"node_modules"
],
"ts-node": {
"compilerOptions": {
"module": "commonjs"
},
"typeRoots": ["./node_modules/@types"]
"typeRoots": [
"./node_modules/@types"
]
}
}

0 comments on commit 1f63d85

Please sign in to comment.