mirror of
https://github.com/m1ngsama/FUJI.git
synced 2025-12-24 10:51:27 +00:00
fix cors
This commit is contained in:
parent
adca70b4a1
commit
ff1eb745ed
4 changed files with 39 additions and 3 deletions
|
|
@ -225,4 +225,15 @@ export default defineConfig({
|
||||||
experimentalReactChildren: true,
|
experimentalReactChildren: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
vite: {
|
||||||
|
server: {
|
||||||
|
proxy: {
|
||||||
|
"/active": {
|
||||||
|
target: "https://active.nbtca.space",
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: path => path.replace(/^\/active/, ""),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,14 @@ http {
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/index.html =404;
|
try_files $uri $uri/index.html =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /active {
|
||||||
|
proxy_pass https://active.nbtca.space;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
rewrite ^/active/(.*)$ /$1 break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,12 +1,28 @@
|
||||||
// app/page.tsx
|
// app/page.tsx
|
||||||
import { Button } from "@nextui-org/react"
|
import { Button } from "@nextui-org/react"
|
||||||
|
import { activeClient } from "../../../utils/client"
|
||||||
// import { NextUIProvider } from "@nextui-org/react";
|
// import { NextUIProvider } from "@nextui-org/react";
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button>Click me</Button>
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
activeClient.freshman.postFreshmanAdd({
|
||||||
|
requestBody: {
|
||||||
|
class: "1",
|
||||||
|
name: "1",
|
||||||
|
phone: "1",
|
||||||
|
qq: "1",
|
||||||
|
email: "1",
|
||||||
|
number: "1",
|
||||||
|
major: "1",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Click me
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,5 @@ export const saturdayClient = createClient<saturdayPaths>({
|
||||||
// baseUrl: "https://active.nbtca.space/",
|
// baseUrl: "https://active.nbtca.space/",
|
||||||
// })
|
// })
|
||||||
export const activeClient = new ApiClient({
|
export const activeClient = new ApiClient({
|
||||||
BASE: "https://active.nbtca.space/",
|
BASE: "/active",
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue