Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ccb721de

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

FIX: checkAuth on homepage added
re #10896

Zobrazit rozdíly:

src/pages/HomePage.tsx
10 10
import { log } from "../logging/logger"
11 11
import { HOME_PAGE_IMG_URL } from "../api/constants"
12 12
import { ErrorToast } from "../components/toast/ErrorToast"
13
import {checkAuth} from "../stores/actions/userThunks"
13 14
// import { Image } from "react-native"
14 15

  
15 16
const HomePage = ({navigation}: DrawerScreenProps<RootStackParamList, 'Home'>) => {
......
37 38
    const dispatch = useDispatch<AppDispatch>()
38 39

  
39 40
    useEffect(() => {
41
        dispatch(checkAuth())
42

  
40 43
        if (data === null || data.length === 0 && !loading) {
41 44
            dispatch(fetchData())
42 45
        }
src/stores/reducers/userSlice.ts
57 57
        builder.addCase(checkAuth.rejected, (state, action) => {
58 58
            state.lastError = action.error.message
59 59
            state.checkedAuth = true
60
            state.loggedIn = false
60 61
        })
61 62
        builder.addCase(logout.fulfilled, (state, action) => initialState)
62 63
    }

Také k dispozici: Unified diff