Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
register
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasEbbinghaus25 committed Jun 12, 2024
1 parent 3ea988a commit 44775c5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/web/src/services/AuthService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ export const register = async (username: string, email: string, password: string
};

export const saveUserDataToLocalStorage = (data: { accountId: number; userId: number; username: string; accessToken: string; }): void => {
localStorage.setItem('accountId', "" + data.accountId.toString());
localStorage.setItem('userId', data.userId.toString());
localStorage.setItem('username', data.username);
localStorage.setItem('token', data.accessToken);
if (data.accountId !== undefined && data.userId !== undefined && data.username && data.accessToken) {
localStorage.setItem('accountId', data.accountId.toString());
localStorage.setItem('userId', data.userId.toString());
localStorage.setItem('username', data.username);
localStorage.setItem('token', data.accessToken);
} else {
console.error('Invalid user data:', data);
}
};

export const login = async (username: string, password: string, rememberMe: boolean): Promise<any> => {
Expand Down

0 comments on commit 44775c5

Please sign in to comment.