rename frontend directory to frontend
This commit is contained in:
parent
71a9b69e04
commit
c7d996dbeb
30 changed files with 1 additions and 1 deletions
18
crawler/frontend/src/auth/authService.ts
Normal file
18
crawler/frontend/src/auth/authService.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { User, UserManager } from 'oidc-client-ts';
|
||||
import { oidcConfig } from './config';
|
||||
|
||||
const userManager = new UserManager(oidcConfig);
|
||||
|
||||
export const login = () => userManager.signinRedirect();
|
||||
export const logout = () => userManager.signoutRedirect();
|
||||
export const handleCallback = () => userManager.signinRedirectCallback();
|
||||
|
||||
export const getUser = async (): Promise<User | null> => {
|
||||
try {
|
||||
const user = await userManager.getUser();
|
||||
return user;
|
||||
} catch (error) {
|
||||
console.error('Error fetching user:', error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue