2031
This commit is contained in:
parent
62bd20c906
commit
10dda20662
|
@ -1,10 +1,45 @@
|
|||
import { api } from "@nice/client"
|
||||
import { useEffect } from "react"
|
||||
|
||||
export default function HomePage() {
|
||||
const { data } = api.staff.findMany.useQuery({ take: 10 })
|
||||
useEffect(() => {
|
||||
import { api, useStaff } from "@nice/client"
|
||||
import { useAuth } from "@web/src/providers/auth-provider";
|
||||
import { Button, Tag } from "antd";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
function HomePage(){
|
||||
const {data} = api.staff.findMany.useQuery({
|
||||
take: 10
|
||||
})
|
||||
const {user,}=useAuth()
|
||||
const {update,create}=useStaff()
|
||||
const [counter, setCounter] = useState(0)
|
||||
const counterText=useMemo(()=>{
|
||||
return `当前计数为:${counter}`
|
||||
},[counter])
|
||||
// const test=async ()=>{
|
||||
|
||||
// await update.mutateAsync({
|
||||
// where: {
|
||||
// username: user?.username
|
||||
// },
|
||||
// data: {
|
||||
// username: "test"
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
useEffect(()=>{
|
||||
console.log(data)
|
||||
}, [data])
|
||||
return <>Home</>
|
||||
}
|
||||
},[data])
|
||||
|
||||
return <div className="p-2 space-y-2">
|
||||
<Tag>当前计数为:{counter}</Tag>
|
||||
<div className="p-z space-x-2">
|
||||
<Button type="primary" onClick={()=>{setCounter(counter + 1)}}>加1</Button>
|
||||
<Button danger onClick={()=>{setCounter(counter - 1)}}>减1</Button>
|
||||
</div>
|
||||
{
|
||||
data?.map(i=>{
|
||||
return <div className="p-2 rounded border shadow"><Tag>i.username</Tag></div>
|
||||
})
|
||||
}
|
||||
|
||||
</div>
|
||||
}
|
||||
export default HomePage;
|
||||
// export {HomePage};//main-route那里也需要加括号
|
|
@ -6,7 +6,7 @@ export const MainRoute: CustomRouteObject = {
|
|||
element: <MainLayout></MainLayout>,
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
index: true, //默认为主页,app进入第一次进入这个页面
|
||||
element: <HomePage />,
|
||||
},
|
||||
],
|
||||
|
|
|
@ -27,7 +27,8 @@ server {
|
|||
# 压缩HTTP版本
|
||||
gzip_http_version 1.1;
|
||||
# 压缩的文件类型
|
||||
gzip_types text/plain
|
||||
gzip_types
|
||||
text/plain
|
||||
text/css
|
||||
application/json
|
||||
application/javascript
|
||||
|
@ -90,8 +91,8 @@ server {
|
|||
add_header 'Access-Control-Allow-Origin' '$http_origin' always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers'
|
||||
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'
|
||||
add_header 'Access-Control-Allow-Headers'
|
||||
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'
|
||||
always;
|
||||
}
|
||||
# 内部认证服务位置
|
||||
|
@ -110,4 +111,4 @@ server {
|
|||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Query-Params $query_string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"dev": "pnpm run --parallel dev",
|
||||
"db:clear": "pnpm --filter common run db:clear"
|
||||
"dev": "pnpm run --parallel dev",
|
||||
"db:clear": "pnpm --filter common run db:clear",
|
||||
"studio": "pnpm --filter common run studio"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "insiinc",
|
||||
|
|
Loading…
Reference in New Issue