alright thanks, so i already have a working login that fetches from the backend already and i've also stored it into redux store.
so basically the response of the login action that i would receive is:
{
"status": 200,
"message": "Success",
"token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaGlyb2phcEBnbWFpbC5jb20iLCJlbWFpbCI6ImRoaXJvamFwQGdtYWlsLmNvbSIsIm5iZiI6MTcwMTYxMTI4MywiZXhwIjoxNzAxNjEzMDgzLCJpYXQiOjE3MDE2MTEyODMsImlzcyI6Iklzc3VlciIsImF1ZCI6IkF1ZGllbmNlIn0.ZUBj7qX1YqIKJoFUQnXbmSPvQbe41yVga9OMuBfvw355_DuyykGMxrNY67pkq2fiOWrs0UghnllJzpvGapp8bQ",
"tokenExpiration": "2023-12-03T14:18:03.4132094Z",
"user": {
"id": "bc98dbe6-ae32-48c1-a05a-b55c3e17898b",
"name": "User1",
"phoneNumber": "0818693080",
"email": "[email protected]",
"gender": "Male",
"birthdate": "2023-12-02T00:00:00"
}
}
ive stored it like this:
interface User {
id: string;
name: string;
phoneNumber: string;
email: string;
gender: string;
birthdate: string;
}
interface UserState {
user: User | null;
token: string | null;
isAuthenticated: boolean;
tokenExpiration: Date | null;
}
const initialState: UserState = {
user: null,
token: null,
isAuthenticated: false,
tokenExpiration: null,
};
but i dont really know how can i utilize the token, could u help me?