Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
9682c827
authored
Apr 23, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 凭证校验
parent
e8d4933d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
+13
-12
src/components/Layout/auth.tsx
+1
-1
src/pages/model/list/index.tsx
+1
-3
src/pages/number/setting.tsx
+3
-2
src/store/user.ts
+8
-6
No files found.
src/components/Layout/auth.tsx
View file @
9682c827
...
...
@@ -33,7 +33,7 @@ const Auth = ({ children }: { children: JSX.Element }) => {
{
onError
(
error
)
{
console
.
log
(
'error->'
,
error
);
router
.
push
(
'/login'
);
router
.
replace
(
'/login'
);
toast
();
},
onSettled
()
{
...
...
src/pages/model/list/index.tsx
View file @
9682c827
...
...
@@ -38,9 +38,7 @@ const modelList = () => {
async
(
modelId
:
string
)
=>
{
setIsLoading
(
true
);
try
{
const
chatId
=
await
getChatSiteId
(
modelId
);
router
.
push
(
`/chat?chatId=
${
chatId
}
`
,
undefined
,
{
router
.
push
(
`/chat?modelId=
${
modelId
}
`
,
undefined
,
{
shallow
:
true
});
}
catch
(
err
:
any
)
{
...
...
src/pages/number/setting.tsx
View file @
9682c827
...
...
@@ -18,7 +18,7 @@ const PayModal = dynamic(() => import('./components/PayModal'));
const
NumberSetting
=
()
=>
{
const
router
=
useRouter
();
const
{
userInfo
,
updateUserInfo
,
initUserInfo
}
=
useUserStore
();
const
{
userInfo
,
updateUserInfo
,
initUserInfo
,
setUserInfo
}
=
useUserStore
();
const
{
setLoading
}
=
useGlobalStore
();
const
{
register
,
handleSubmit
}
=
useForm
<
UserUpdateParams
>
({
defaultValues
:
userInfo
as
UserType
...
...
@@ -47,8 +47,9 @@ const NumberSetting = () => {
const
onclickLogOut
=
useCallback
(()
=>
{
clearToken
();
setUserInfo
(
null
);
router
.
replace
(
'/login'
);
},
[
router
]);
},
[
router
,
setUserInfo
]);
return
(
<>
...
...
src/store/user.ts
View file @
9682c827
...
...
@@ -11,7 +11,7 @@ import { getTokenLogin } from '@/api/user';
type
State
=
{
userInfo
:
UserType
|
null
;
initUserInfo
:
()
=>
Promise
<
null
>
;
setUserInfo
:
(
user
:
UserType
,
token
?:
string
)
=>
void
;
setUserInfo
:
(
user
:
UserType
|
null
,
token
?:
string
)
=>
void
;
updateUserInfo
:
(
user
:
UserUpdateParams
)
=>
void
;
myModels
:
ModelSchema
[];
getMyModels
:
()
=>
void
;
...
...
@@ -27,12 +27,14 @@ export const useUserStore = create<State>()(
get
().
setUserInfo
(
res
);
return
null
;
},
setUserInfo
(
user
:
UserType
,
token
?:
string
)
{
setUserInfo
(
user
:
UserType
|
null
,
token
?:
string
)
{
set
((
state
)
=>
{
state
.
userInfo
=
{
...
user
,
balance
:
formatPrice
(
user
.
balance
)
};
state
.
userInfo
=
user
?
{
...
user
,
balance
:
formatPrice
(
user
.
balance
)
}
:
null
;
});
token
&&
setToken
(
token
);
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment