mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix(auth): token assignment in AuthProvider
(#6593)
This commit is contained in:
parent
19a263ff5a
commit
febaef9cf9
@ -13,15 +13,13 @@ import React, { useEffect } from 'react';
|
||||
export const AuthProvider: React.FC = (props) => {
|
||||
const searchString = useLocationSearch();
|
||||
const app = useApp();
|
||||
const params = new URLSearchParams(searchString);
|
||||
const authenticator = params.get('authenticator');
|
||||
const token = params.get('token');
|
||||
if (token) {
|
||||
app.apiClient.auth.setToken(token);
|
||||
app.apiClient.auth.setAuthenticator(authenticator);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const params = new URLSearchParams(searchString);
|
||||
const authenticator = params.get('authenticator');
|
||||
const token = params.get('token');
|
||||
if (token) {
|
||||
app.apiClient.auth.setToken(token);
|
||||
app.apiClient.auth.setAuthenticator(authenticator);
|
||||
}
|
||||
});
|
||||
return <>{props.children}</>;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user