diff options
author | Michael Hunteman <michael@huntm.net> | 2024-06-23 13:55:42 -0700 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2024-06-23 13:55:42 -0700 |
commit | 07752babb4e692452e1cd7f2133c4d8dde1b3b1c (patch) | |
tree | b3be7698f1af43f83bccd3bbbf6e19cd03532f1b /client/src/features | |
parent | 4bf5d1a620dfe96ea9593d44cfcd0f142fcdec61 (diff) |
Authenticate UI users
Diffstat (limited to 'client/src/features')
-rw-r--r-- | client/src/features/auth/authSlice.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/client/src/features/auth/authSlice.ts b/client/src/features/auth/authSlice.ts index bff2bdd..878de0c 100644 --- a/client/src/features/auth/authSlice.ts +++ b/client/src/features/auth/authSlice.ts @@ -1,4 +1,5 @@ import { createSlice } from '@reduxjs/toolkit'; +import type { PayloadAction } from '@reduxjs/toolkit'; import type { RootState } from '../../store'; import type { Guest } from '../../apiSlice'; @@ -11,8 +12,12 @@ const authSlice = createSlice({ name: 'auth', initialState: { guest: undefined, token: undefined } as AuthState, reducers: { - setCredentials: (state, action) => { - const { guest, token } = action.payload; + setCredentials: ( + state, + { + payload: { guest, token }, + }: PayloadAction<{ guest: Guest; token: string }> + ) => { state.guest = guest; state.token = token; }, |