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/pages/LoginPage.tsx
9 9
    Button,
10 10
    HStack,
11 11
    Text,
12
    KeyboardAvoidingView
12
    KeyboardAvoidingView, useToast
13 13
} from "native-base"
14 14
import { useCallback, useEffect, useState } from "react"
15 15
import { useDispatch, useSelector } from "react-redux"
......
19 19
import { log } from "../logging/logger"
20 20
import * as SplashScreen from "expo-splash-screen"
21 21
import { ApplicationHeading } from "../components/reusables/ApplicationHeading"
22
import {consumeError} from "../stores/reducers/userSlice"
22 23

  
23 24

  
24 25
const LoginPage = () => {
......
28 29

  
29 30
    const dispatch = useDispatch<AppDispatch>()
30 31

  
32
    const toast = useToast()
31 33
    const loginUser = () => {
32 34
        log.debug("LoginPage", "loginUser", "dispatching login")
33 35
        dispatch(login({username, password}))
34 36
        //TODO - add error handling
35 37
    }
36 38

  
37

  
38 39
    useEffect(() => {
39 40
        dispatch(checkAuth())
40 41
    }, [])
41 42

  
43
    useEffect(() => {
44
        if (lastError) {
45
            toast.show({
46
                title: "Error",
47
                description: lastError,
48
                placement: "top",
49
                duration: 3000,
50
            })
51
            // dispatch(consumeError())
52
        }
53
    }, [lastError]);
54

  
42 55
    return (
43 56
        <KeyboardAvoidingView
44 57
            behavior={ Platform.OS === "ios" ? "padding" : "height" }
......
49 62
                lg: "auto"
50 63
            } }
51 64
        >
65

  
52 66
            <Center w="100%">
53 67
                <VStack
54 68
                    p="2"

Také k dispozici: Unified diff