Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
library-app-flutter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Ilham Maulana
library-app-flutter
Commits
07297576
Commit
07297576
authored
Aug 05, 2024
by
Ilham Maulana
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: handle error message on sign up form
parent
1e317d45
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
auth_provider.dart
lib/src/providers/auth_provider.dart
+3
-0
sign_up_form.dart
lib/src/widgets/forms/sign_up_form.dart
+6
-2
No files found.
lib/src/providers/auth_provider.dart
View file @
07297576
...
...
@@ -146,12 +146,15 @@ class AuthProvider with ChangeNotifier {
String
token
=
Token
.
fromJson
(
data
)!.
key
;
storeAccessToken
(
token
);
isAuthenticated
=
true
;
message
=
null
;
if
(
context
.
mounted
)
{
context
.
go
(
"/"
);
}
debugPrint
(
"Signup successful
$token
"
);
}
else
{
final
data
=
jsonDecode
(
response
.
body
);
message
=
data
[
"message"
];
debugPrint
(
"Error: sign up failed,
${response.statusCode}
:
${response.body}
"
);
}
...
...
lib/src/widgets/forms/sign_up_form.dart
View file @
07297576
...
...
@@ -40,6 +40,8 @@ class _SignUpForm extends State<SignUpForm> {
const
String
formText
=
"Sign In to get started"
;
return
Consumer
<
AuthProvider
>(
builder:
(
context
,
authProvider
,
child
)
{
final
message
=
authProvider
.
message
;
return
Column
(
children:
[
Padding
(
...
...
@@ -120,8 +122,10 @@ class _SignUpForm extends State<SignUpForm> {
},
keyboardType:
TextInputType
.
visiblePassword
,
),
const
SizedBox
(
height:
20.0
,
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
20.0
),
child:
Text
(
message
??
""
,
style:
const
TextStyle
(
color:
Colors
.
red
)),
),
Column
(
children:
[
...
...
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