Revize 8c57f958
Přidáno uživatelem Václav Honzík před asi 2 roky(ů)
frontend/src/features/Auth/userSlice.ts | ||
---|---|---|
28 | 28 |
|
29 | 29 |
export const userSlice = createSlice({ |
30 | 30 |
name: 'user', // name to generate action types |
31 |
|
|
32 | 31 |
initialState, // default state |
33 |
|
|
34 | 32 |
// Reducers that update the state |
35 | 33 |
reducers: { |
36 | 34 |
logout: () => initialState, // Reset to the inital state |
... | ... | |
57 | 55 |
return { ...state, lastErr: action.error.message } |
58 | 56 |
} |
59 | 57 |
}) |
60 |
builder.addCase(logIn.pending, (state, action) => {
|
|
58 |
builder.addCase(logIn.pending, (state) => { |
|
61 | 59 |
return { ...state, isLoggingIn: true } |
62 | 60 |
}) |
63 | 61 |
}, |
... | ... | |
65 | 63 |
|
66 | 64 |
const userReducer = persistReducer(persistConfig, userSlice.reducer) |
67 | 65 |
|
68 |
export const { logout, refreshTokens, setErr, setUserState, resetLoggingIn } = userSlice.actions |
|
66 |
export const { logout, refreshTokens, setErr, setUserState, resetLoggingIn } = |
|
67 |
userSlice.actions |
|
69 | 68 |
|
70 | 69 |
export default userReducer |
Také k dispozici: Unified diff
refactor to use Redux instead of localstate
re #9629