-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fast-fix(auth): add test user & token to remove auto logging in
- Loading branch information
1 parent
623097a
commit 512028f
Showing
2 changed files
with
36 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,41 @@ | ||
import { UserModel } from '@app/domain/UserModel'; | ||
import avatarImg from '@app/assets/avatars/avatar5.png'; | ||
|
||
const testUser = { | ||
id: 1, | ||
firstName: 'Christopher', | ||
lastName: 'Johnson', | ||
imgUrl: avatarImg, | ||
userName: '@john1989', | ||
email: { | ||
name: '[email protected]', | ||
verified: true, | ||
}, | ||
phone: { | ||
number: '+18143519459', | ||
verified: true, | ||
}, | ||
sex: 'male', | ||
birthday: '01/26/2022', | ||
lang: 'en', | ||
country: 'GB', | ||
city: 'London', | ||
address1: '14 London Road', | ||
zipcode: 5211, | ||
website: 'altence.com', | ||
socials: { | ||
twitter: '@altence_team', | ||
facebook: 'https://facebook.com/groups/1076577369582221', | ||
linkedin: 'https://linkedin.com/company/altence', | ||
}, | ||
}; | ||
|
||
export const persistToken = (token: string): void => { | ||
localStorage.setItem('accessToken', token); | ||
}; | ||
|
||
export const readToken = (): string | null => { | ||
return localStorage.getItem('accessToken'); | ||
export const readToken = (): string => { | ||
return localStorage.getItem('accessToken') || 'bearerToken'; | ||
}; | ||
|
||
export const persistUser = (user: UserModel): void => { | ||
|
@@ -15,7 +45,7 @@ export const persistUser = (user: UserModel): void => { | |
export const readUser = (): UserModel | null => { | ||
const userStr = localStorage.getItem('user'); | ||
|
||
return userStr ? JSON.parse(userStr) : null; | ||
return userStr ? JSON.parse(userStr) : testUser; | ||
}; | ||
|
||
export const deleteToken = (): void => localStorage.removeItem('accessToken'); | ||
|