2019-01-18 14:47:10 +01:00
|
|
|
import { AUTH_TOKEN, AUTH_USER_EMAIL, AUTH_USER_ID } from '@/constants';
|
2019-01-11 13:58:29 +01:00
|
|
|
import { ILogin } from '@/types/login.model';
|
|
|
|
|
|
|
|
export function saveUserData(obj: ILogin) {
|
|
|
|
localStorage.setItem(AUTH_USER_ID, `${obj.user.id}`);
|
2019-01-18 14:47:10 +01:00
|
|
|
localStorage.setItem(AUTH_USER_EMAIL, obj.user.email);
|
2019-01-11 13:58:29 +01:00
|
|
|
localStorage.setItem(AUTH_TOKEN, obj.token);
|
|
|
|
}
|
2019-01-18 14:47:10 +01:00
|
|
|
|
|
|
|
export function deleteUserData() {
|
2019-03-22 10:57:14 +01:00
|
|
|
for (const key of [AUTH_USER_ID, AUTH_USER_EMAIL, AUTH_TOKEN]) {
|
2019-01-18 14:47:10 +01:00
|
|
|
localStorage.removeItem(key);
|
|
|
|
}
|
|
|
|
}
|