This commit is contained in:
LazuliKao 2024-09-24 17:53:29 +08:00
parent adca70b4a1
commit ff1eb745ed
4 changed files with 39 additions and 3 deletions

View file

@ -225,4 +225,15 @@ export default defineConfig({
experimentalReactChildren: true,
}),
],
vite: {
server: {
proxy: {
"/active": {
target: "https://active.nbtca.space",
changeOrigin: true,
rewrite: path => path.replace(/^\/active/, ""),
},
}
}
}
})

View file

@ -27,5 +27,14 @@ http {
location / {
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;
}
}
}

View file

@ -1,12 +1,28 @@
// app/page.tsx
import { Button } from "@nextui-org/react"
import { activeClient } from "../../../utils/client"
// import { NextUIProvider } from "@nextui-org/react";
export default function Page() {
return (
<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>
)
}

View file

@ -9,5 +9,5 @@ export const saturdayClient = createClient<saturdayPaths>({
// baseUrl: "https://active.nbtca.space/",
// })
export const activeClient = new ApiClient({
BASE: "https://active.nbtca.space/",
BASE: "/active",
})