Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beasy-mobile
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
G
beasy-mobile
Commits
216da516
Commit
216da516
authored
May 07, 2024
by
G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
showing a basic error message when authentication is a failure
parent
e9fa692c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
UserLoginScreen.tsx
src/screens/UserLoginScreen.tsx
+12
-1
Theme.tsx
src/themes/Theme.tsx
+6
-0
No files found.
src/screens/UserLoginScreen.tsx
View file @
216da516
...
...
@@ -22,6 +22,7 @@ const UserLoginScreen: UnloggedUserStackScreenComponentProps<"userLoginScreen">
const
[
email
,
setEmail
]
=
useState
(
""
);
const
[
password
,
setPassword
]
=
useState
(
""
);
const
[
error
,
setError
]
=
useState
(
""
);
const
authenticationMutation
=
useMutation
({
mutationFn
:
authenticateUser
,
...
...
@@ -30,7 +31,11 @@ const UserLoginScreen: UnloggedUserStackScreenComponentProps<"userLoginScreen">
navigation
.
navigate
(
"bottomTabs"
);
},
onError
:
(
error
)
=>
{
console
.
error
(
"error :: "
,
error
);
console
.
error
(
"error :: "
,
error
.
response
.
data
);
if
(
error
.
response
.
status
===
400
)
{
return
setError
(
"Bad request"
);
}
setError
(
error
.
response
.
data
.
detail
);
},
});
...
...
@@ -77,6 +82,7 @@ const UserLoginScreen: UnloggedUserStackScreenComponentProps<"userLoginScreen">
<
Input
label=
"Email"
// value={email}
autoCorrect=
{
false
}
textContentType=
"emailAddress"
onChangeText=
{
setEmail
}
/>
...
...
@@ -89,6 +95,11 @@ const UserLoginScreen: UnloggedUserStackScreenComponentProps<"userLoginScreen">
/>
</
Box
>
</
Box
>
{
error
&&
(
<
Text
variant=
{
"error"
}
textAlign=
{
"center"
}
>
{
error
}
</
Text
>
)
}
<
Box
p=
{
"s"
}
>
<
Button
variant=
{
"full"
}
...
...
src/themes/Theme.tsx
View file @
216da516
...
...
@@ -15,6 +15,8 @@ const palette = {
lightGray
:
"#F4F5F7"
,
gray
:
"#747E98"
,
yellow
:
"#F4C44A"
,
red
:
"#FF0000"
,
};
const
theme
=
createTheme
({
...
...
@@ -27,6 +29,7 @@ const theme = createTheme({
lightGray
:
palette
.
lightGray
,
gray
:
palette
.
gray
,
yellow
:
palette
.
yellow
,
red
:
palette
.
red
,
},
spacing
:
{
s
:
8
,
...
...
@@ -82,6 +85,9 @@ const theme = createTheme({
lightGray
:
{
color
:
"lightGray"
,
},
error
:
{
color
:
"red"
,
},
},
cardVariants
:
{
defaults
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment