fix(auth): token assignment in AuthProvider (#6593)

This commit is contained in:
YANG QIA 2025-03-31 12:53:25 +08:00 committed by GitHub
parent 19a263ff5a
commit febaef9cf9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,15 +13,13 @@ import React, { useEffect } from 'react';
export const AuthProvider: React.FC = (props) => { export const AuthProvider: React.FC = (props) => {
const searchString = useLocationSearch(); const searchString = useLocationSearch();
const app = useApp(); 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}</>; return <>{props.children}</>;
}; };