Skip to content

Commit

Permalink
fix: fix main.dart 's format.
Browse files Browse the repository at this point in the history
  • Loading branch information
cwp0 committed Jul 20, 2023
1 parent abc0f71 commit 491e353
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ class _MyAppState extends State<MyApp> {
final result = await _casdoor.show();
// Get code
final code = Uri.parse(result).queryParameters['code'] ?? "";
if(_token == 'User is not logged in') {
if (_token == 'User is not logged in') {
final response = await _casdoor.requestOauthAccessToken(code);
setState(() {
_token = jsonDecode(response.body)["access_token"] as String;
});
} else {
await _casdoor.tokenLogout('idTokenHint', 'postLogoutRedirectUri', 'state');
await _casdoor.tokenLogout(
'idTokenHint', 'postLogoutRedirectUri', 'state');
setState(() {
_token = 'User is not logged in';
});
Expand All @@ -88,7 +89,8 @@ class _MyAppState extends State<MyApp> {
),
floatingActionButton: FloatingActionButton(
onPressed: authenticate,
tooltip: _token == 'User is not logged in' ? 'Authenticate' : 'Logout',
tooltip:
_token == 'User is not logged in' ? 'Authenticate' : 'Logout',
child: const Icon(Icons.people),
)),
);
Expand Down

0 comments on commit 491e353

Please sign in to comment.