Merge pull request #1 from Ai-hack-MAGNUM-OPUS/add-net

add base api
This commit is contained in:
Ilia vasilenko 2022-08-26 23:45:41 +03:00 committed by GitHub
commit 78a3a0cb3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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": {
"@ant-design/icons": "^4.7.0",
"antd": "^4.22.8",
"axios": "^0.27.2",
"next": "12.2.5",
"react": "18.2.0",
"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}>
<Header></Header>
<div className={}>
<div>
</div>
<div>