Refactoring
This commit is contained in:
@@ -44,14 +44,18 @@ const SiteNav: React.FC<unknown> = () => {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
const handleSignIn = async () => {
|
const handleSignIn = async () => {
|
||||||
try {
|
instance.handleRedirectPromise().then((response) => {
|
||||||
await instance.handleRedirectPromise()
|
if (response) {
|
||||||
await instance.loginRedirect({
|
console.log(response)
|
||||||
scopes: [`api://${import.meta.env.VITE_CLIENT_ID}/user_impersonation`]
|
console.log('successful login', response);
|
||||||
});
|
} else {
|
||||||
} catch (error) {
|
instance.loginRedirect({
|
||||||
|
scopes: [`api://${import.meta.env.VITE_CLIENT_ID}/user_impersonation`]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
})
|
||||||
};
|
};
|
||||||
const handleSignOut = () => {
|
const handleSignOut = () => {
|
||||||
instance.logoutRedirect();
|
instance.logoutRedirect();
|
||||||
|
|||||||
Reference in New Issue
Block a user