Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 7410d6c1

Přidáno uživatelem Michal Schwob před více než 1 rok

Added skeleton of Stack Navigation
re #10820

Zobrazit rozdíly:

src/stores/reducers/userSlice.ts
22 22
    reducers: {
23 23
        resetState: (state) => {
24 24
            state = initialState
25
        },
26
        consumeError: (state) => {
27
            state.lastError = undefined
25 28
        }
26 29
    },
27 30
    extraReducers: (builder) => {
......
29 32
            state.username = action.payload.username
30 33
            state.loggedIn = true
31 34
            state.role = action.payload.role
32
            state.lastError = ""
35
            state.lastError = undefined
33 36
        })
34 37
        builder.addCase(login.rejected, (state, action) => {
35 38
            state.lastError = action.error.message
36 39
        })
37 40
        builder.addCase(checkAuth.fulfilled, (state, action) => {
38 41
            state.loggedIn = action.payload.isLogged
39
            state.lastError = ""
42
            state.lastError = undefined
40 43
            state.checkedAuth = true
41 44
        })
42 45
        builder.addCase(checkAuth.rejected, (state, action) => {
......
47 50
    }
48 51
})
49 52

  
50
export const { resetState } = userSlice.actions
53
export const { resetState, consumeError } = userSlice.actions
51 54

  
52 55
export default userSlice.reducer

Také k dispozici: Unified diff