File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ import { API_URL } from "../_config/api.config";
44
55const ENDPOINT_URL = "/users" ;
66
7+ function setUserInLocalStorage ( user : User ) {
8+ // store user details and jwt token in local storage to keep user logged in between page refreshes
9+ localStorage . setItem ( "user" , JSON . stringify ( user ) ) ;
10+ }
11+
712function login ( email : string , password : string ) : Promise < User > {
813 const requestOptions = {
914 method : "POST" ,
@@ -74,11 +79,6 @@ function changePassword(password: string): Promise<boolean> {
7479 ) ;
7580}
7681
77- function setUserInLocalStorage ( user : User ) {
78- // store user details and jwt token in local storage to keep user logged in between page refreshes
79- localStorage . setItem ( "user" , JSON . stringify ( user ) ) ;
80- }
81-
8282function logout ( ) {
8383 localStorage . removeItem ( "user" ) ;
8484}
You can’t perform that action at this time.
0 commit comments