Front: Type authentication string for more clarity

This commit is contained in:
Arthi-chaud
2022-08-15 10:15:00 +02:00
parent e89c66feea
commit bf5d2add77
2 changed files with 6 additions and 2 deletions

View File

@@ -0,0 +1,3 @@
type AuthToken = string;
export default AuthToken;

View File

@@ -1,12 +1,13 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import AuthToken from '../models/AuthToken';
export const userSlice = createSlice({
name: 'user',
initialState: {
token: undefined as string | undefined
token: undefined as AuthToken | undefined
},
reducers: {
setUserToken: (state, action: PayloadAction<string>) => {
setUserToken: (state, action: PayloadAction<AuthToken>) => {
state.token = action.payload;
},
unsetUserToken: (state) => {