-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add weski proxy to fix build error
- Loading branch information
1 parent
fb0a595
commit 8b4eb72
Showing
3 changed files
with
22 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { NextApiRequest, NextApiResponse } from 'next'; | ||
import { API_URL } from '@/shared/config'; | ||
|
||
export default async function handler(req: NextApiRequest, res: NextApiResponse) { | ||
const { path } = req.query; | ||
const url = `${API_URL}/${(path as string[]).join('/')}`; | ||
|
||
const response = await fetch(url, { | ||
method: req.method, | ||
headers: { | ||
...(req.headers as Record<string, string>), | ||
}, | ||
body: req.method !== 'GET' ? JSON.stringify(req.body) : undefined, | ||
}); | ||
|
||
const data = await response.json(); | ||
|
||
res.status(response.status).json(data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters