Allows for in-app upgrade (#1642)
This commit is contained in:
1 parent
07b75dadbd
commit
2fbdb93efb
19 files changed
+68
-68
No files matched your search
@@ -12,7 +12,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
return res.status(401).json({ message: "Not authenticated" });
|
||||
}
|
||||
|
||||
if (req.method !== "GET") {
|
||||
if (!["GET", "POST"].includes(req.method!)) {
|
||||
throw new HttpCode({ statusCode: 405, message: "Method Not Allowed" });
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
});
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.url) throw new HttpCode({ statusCode: 401, message: data.message });
|
||||
|
||||
res.redirect(303, data.url);
|
||||
} catch (error) {
|
||||
console.error(`error`, error);
|
||||
|
||||
Reference in new issue
Block a user