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.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/features/auth/authSlice.ts b/src/features/auth/authSlice.ts
index 9716131..04be93f 100644
--- a/src/features/auth/authSlice.ts
+++ b/src/features/auth/authSlice.ts
@@ -1,18 +1,21 @@
import { createSlice } from '@reduxjs/toolkit';
import type { RootState } from '../../store';
+import { User } from '../../apiSlice';
type AuthState = {
user: User | null
+ id: number | null
token: string | null
}
const authSlice = createSlice({
name: 'auth',
- initialState: { user: null, token: null } as AuthState,
+ initialState: { user: null, token: null, id: null } as AuthState,
reducers: {
setCredentials: (state, action) => {
- const { user, token } = action.payload;
+ const { user, token, id } = action.payload;
state.user = user;
+ state.id = id;
state.token = token;
}
}