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
50af315d
Commit
50af315d
authored
Aug 06, 2024
by
Ilham Maulana
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: reset all state on logout
parent
26b9e778
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
auth_provider.dart
lib/src/providers/auth_provider.dart
+20
-13
No files found.
lib/src/providers/auth_provider.dart
View file @
50af315d
...
...
@@ -53,6 +53,25 @@ class AuthProvider with ChangeNotifier {
invalidUsernameOrPassword
=
value
;
}
void
resetAllState
()
{
user
=
null
;
message
=
null
;
memberLoans
=
null
;
loans
=
null
;
nearOutstandingLoans
=
null
;
overduedLoans
=
null
;
isAuthenticated
=
false
;
invalidUsernameOrPassword
=
false
;
filterByUpcoming
=
false
;
filterByOverdued
=
false
;
isLoading
=
false
;
resetPasswordTokenSended
=
false
;
resetPasswordSucced
=
false
;
changePasswordSucced
=
false
;
loanBookSuccess
=
false
;
}
Future
<
void
>
signIn
(
BuildContext
context
,
String
username
,
String
password
)
async
{
try
{
...
...
@@ -102,19 +121,7 @@ class AuthProvider with ChangeNotifier {
if
(
response
.
statusCode
==
200
)
{
await
storage
.
delete
(
key:
'token'
);
isAuthenticated
=
false
;
user
=
null
;
filterByUpcoming
=
false
;
filterByOverdued
=
false
;
memberLoans
=
null
;
isLoading
=
false
;
resetPasswordTokenSended
=
false
;
resetPasswordSucced
=
false
;
loans
=
null
;
nearOutstandingLoans
=
null
;
overduedLoans
=
null
;
resetAllState
();
}
else
{
debugPrint
(
"Logout failed:
${response.statusCode}
${response.body}
"
);
}
...
...
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