Revize 9fa2b717
Přidáno uživatelem Michal Schwob před více než 1 rok
src/pages/LoginPage.tsx | ||
---|---|---|
57 | 57 |
behavior={ Platform.OS === "ios" ? "padding" : "height" } |
58 | 58 |
flex={ 1 } |
59 | 59 |
justifyContent={ "center" } |
60 |
h={ { |
|
61 |
base: "400px", |
|
62 |
lg: "auto" |
|
63 |
} } |
|
60 |
h={ {lg: "auto"} } |
|
61 |
// behavior={ "padding" } |
|
62 |
keyboardVerticalOffset={ 100 } |
|
64 | 63 |
> |
65 | 64 |
|
66 | 65 |
<Center w="100%"> |
67 | 66 |
<VStack |
68 | 67 |
p="2" |
69 | 68 |
w="80%" |
70 |
justifyContent={ "center" }
|
|
69 |
justifyContent={ "space-between" }
|
|
71 | 70 |
> |
72 | 71 |
<ApplicationHeading /> |
73 | 72 |
<Heading |
src/stores/actions/userThunks.ts | ||
---|---|---|
1 | 1 |
import { createAsyncThunk } from "@reduxjs/toolkit" |
2 | 2 |
import { isAuthRequest, loginRequest, logoutRequest } from "../../api/authservice" |
3 | 3 |
import { log } from "../../logging/logger" |
4 |
import {Toast} from "native-base" |
|
4 | 5 |
|
5 | 6 |
export const login = createAsyncThunk( |
6 | 7 |
"user/login", |
... | ... | |
15 | 16 |
role: response.data.role |
16 | 17 |
} |
17 | 18 |
} else { |
19 |
Toast.show({ |
|
20 |
title: `Login not 200 (${response.status}): ${response}`, |
|
21 |
duration: 10000 |
|
22 |
}) |
|
18 | 23 |
return Promise.reject(response.data ? response.data : "Login failed") |
19 | 24 |
} |
20 | 25 |
} catch (err: any) { |
21 |
return Promise.reject(err.response.data) |
|
26 |
Toast.show({ |
|
27 |
title: `Login err: ${err}`, |
|
28 |
duration: 10000 |
|
29 |
}) |
|
30 |
return Promise.reject(err.response ? err.response.data : "Something went wrong" + err) |
|
22 | 31 |
} |
23 | 32 |
} |
24 | 33 |
) |
... | ... | |
30 | 39 |
const response = await isAuthRequest() |
31 | 40 |
console.log(response) |
32 | 41 |
if (response.status === 200) { |
42 |
Toast.show({ |
|
43 |
title: `Auth ok: ${response.data}`, |
|
44 |
duration: 10000 |
|
45 |
}) |
|
33 | 46 |
return { |
34 | 47 |
isLogged: response.data.isauth |
35 | 48 |
} |
36 | 49 |
} else { |
50 |
Toast.show({ |
|
51 |
title: `Auth err: ${response.data ? response.data : "Check authentication failed"}`, |
|
52 |
duration: 10000 |
|
53 |
}) |
|
37 | 54 |
return Promise.reject(response.data ? response.data : "Check authentication failed") |
38 | 55 |
} |
39 | 56 |
} catch (err: any) { |
40 |
return Promise.reject(err.response.data) |
|
57 |
Toast.show({ |
|
58 |
title: `Auth err: ${err}`, |
|
59 |
duration: 10000 |
|
60 |
}) |
|
61 |
return Promise.reject(err.response ? err.response.data : "Something went wrong" + err) |
|
41 | 62 |
} |
42 | 63 |
} |
43 | 64 |
) |
Také k dispozici: Unified diff
DEBUG: Added toast for in app debug
re #10822