summaryrefslogtreecommitdiff
path: root/src/features/auth/authSlice.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/auth/authSlice.ts')
-rw-r--r--src/features/auth/authSlice.ts14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/features/auth/authSlice.ts b/src/features/auth/authSlice.ts
index 04be93f..d5b294c 100644
--- a/src/features/auth/authSlice.ts
+++ b/src/features/auth/authSlice.ts
@@ -1,21 +1,19 @@
import { createSlice } from '@reduxjs/toolkit';
import type { RootState } from '../../store';
-import { User } from '../../apiSlice';
+import { Guest } from '../../apiSlice';
type AuthState = {
- user: User | null
- id: number | null
+ guest: Guest | null
token: string | null
}
const authSlice = createSlice({
name: 'auth',
- initialState: { user: null, token: null, id: null } as AuthState,
+ initialState: { guest: null, token: null } as AuthState,
reducers: {
setCredentials: (state, action) => {
- const { user, token, id } = action.payload;
- state.user = user;
- state.id = id;
+ const { guest, token } = action.payload;
+ state.guest = guest;
state.token = token;
}
}
@@ -25,4 +23,4 @@ export const { setCredentials } = authSlice.actions;
export default authSlice.reducer;
-export const selectCurrentUser = (state: RootState) => state.auth.user;
+export const selectCurrentGuest = (state: RootState) => state.auth.guest;