completed group batch feature
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qpay/auth_state.dart';
|
||||
import 'package:qpay/http/http.dart';
|
||||
import 'package:qpay/models/api_response.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -60,15 +61,22 @@ class LoginController extends ChangeNotifier {
|
||||
prefs.setString('username', username);
|
||||
prefs.setString('email', response['email']);
|
||||
prefs.setString('firstName', response['firstName']);
|
||||
prefs.setString('lastName', response['lastName']);
|
||||
prefs.setString('lastName', response['lastName'] ?? '');
|
||||
prefs.setString('phone', response['phone']);
|
||||
prefs.setString('userId', response['uuid']);
|
||||
prefs.setString(
|
||||
'initials',
|
||||
response['firstName'].substring(0, 1) +
|
||||
response['lastName'].substring(0, 1),
|
||||
(response['lastName'] != null && response['lastName'].isNotEmpty
|
||||
? response['lastName'].substring(0, 1)
|
||||
: ''),
|
||||
);
|
||||
|
||||
// Notify the router that the user is now signed in so any
|
||||
// auth-gated redirects (e.g. the groups flow) are re-evaluated
|
||||
// and the user is sent to their originally requested page.
|
||||
await authState.refresh();
|
||||
|
||||
return ApiResponse.success(model);
|
||||
} else {
|
||||
model.errorMessage =
|
||||
|
||||
Reference in New Issue
Block a user