Skip to content

Commit

Permalink
api: redirect all other acts
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeinum committed Feb 5, 2022
1 parent b8cc3f6 commit 8196de4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion api/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,19 @@ const handler: VercelApiHandler = async (request, response) => {

response.send(res.data);
} else {
response.status(400).json({ error: 'Invalid request' });
// redirect all values and method to BASE_URL
const { method, url, headers, body } = request;

const res = await axios(`${BASE_URL}${url}`, {
method: method as any,
headers: {
...(headers as any),
},
data: body,
});

response.send(res.data);

}

}
Expand Down

0 comments on commit 8196de4

Please sign in to comment.