Revize 0efa284e
Přidáno uživatelem Fantič před asi 2 roky(ů)
src/stores/reducers/userSlice.ts | ||
---|---|---|
1 | 1 |
import { createSlice } from "@reduxjs/toolkit" |
2 |
import { login } from "../actions/userThunks" |
|
2 |
import { checkAuth, login } from "../actions/userThunks"
|
|
3 | 3 |
|
4 | 4 |
export interface UserState { |
5 | 5 |
username: string |
... | ... | |
30 | 30 |
builder.addCase(login.rejected, (state, action) => { |
31 | 31 |
state.lastError = action.error.message |
32 | 32 |
}) |
33 |
builder.addCase(checkAuth.fulfilled, (state, action) => { |
|
34 |
state.loggedIn = action.payload.isLogged |
|
35 |
state.lastError = "" |
|
36 |
}) |
|
37 |
builder.addCase(checkAuth.rejected, (state, action) => { |
|
38 |
state.lastError = action.error.message |
|
39 |
}) |
|
33 | 40 |
} |
34 | 41 |
}) |
35 | 42 |
|
Také k dispozici: Unified diff
#re 10343 Check authentication request added