add base api

This commit is contained in:
ilia 2022-08-26 23:44:40 +03:00
parent a40deeedd5
commit 534daf6ac1
7 changed files with 4615 additions and 20 deletions

4602
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -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
View 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
View 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
}

View File

@ -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
View File

@ -0,0 +1,5 @@
const check_state_url = '/state'
export {
check_state_url
}

View File

@ -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>