mirror of
https://github.com/Ai-hack-MAGNUM-OPUS/frontend.git
synced 2024-11-10 19:56:41 +03:00
add base api
This commit is contained in:
parent
a40deeedd5
commit
534daf6ac1
4602
package-lock.json
generated
4602
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/icons": "^4.7.0",
|
"@ant-design/icons": "^4.7.0",
|
||||||
"antd": "^4.22.8",
|
"antd": "^4.22.8",
|
||||||
|
"axios": "^0.27.2",
|
||||||
"next": "12.2.5",
|
"next": "12.2.5",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-doc-viewer": "^0.1.5",
|
"react-doc-viewer": "^0.1.5",
|
||||||
|
|
6
pages/api/check_state.ts
Normal file
6
pages/api/check_state.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import {get} from './fetch'
|
||||||
|
import { check_state_url } from './urls'
|
||||||
|
|
||||||
|
export const check_state = async (uid: string) => {
|
||||||
|
return await get(`${check_state_url}/${uid}`)
|
||||||
|
}
|
6
pages/api/fetch.ts
Normal file
6
pages/api/fetch.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import axios from 'axios'
|
||||||
|
import {host} from './consts'
|
||||||
|
|
||||||
|
export const get = async (url: string) => {
|
||||||
|
return (await axios.get(url)).data
|
||||||
|
}
|
|
@ -1,13 +0,0 @@
|
||||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
|
||||||
import type { NextApiRequest, NextApiResponse } from 'next'
|
|
||||||
|
|
||||||
type Data = {
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function handler(
|
|
||||||
req: NextApiRequest,
|
|
||||||
res: NextApiResponse<Data>
|
|
||||||
) {
|
|
||||||
res.status(200).json({ name: 'John Doe' })
|
|
||||||
}
|
|
5
pages/api/urls.ts
Normal file
5
pages/api/urls.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
const check_state_url = '/state'
|
||||||
|
|
||||||
|
export {
|
||||||
|
check_state_url
|
||||||
|
}
|
|
@ -17,7 +17,7 @@ const Home: NextPage = () => {
|
||||||
<main className={styles.main}>
|
<main className={styles.main}>
|
||||||
<Header></Header>
|
<Header></Header>
|
||||||
|
|
||||||
<div className={}>
|
<div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user