completed velocity integration
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:qpay/abstracts/AbstractController.dart';
|
||||
import 'package:qpay/http/http.dart';
|
||||
import 'package:qpay/models/api_response.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../onboarding_controller.dart';
|
||||
@@ -37,7 +36,7 @@ class PhoneController extends AbstractController {
|
||||
}
|
||||
|
||||
|
||||
Future<void> register() async {
|
||||
Future<ApiResponse<Map<String, dynamic>>> register() async {
|
||||
prefs = await SharedPreferences.getInstance();
|
||||
|
||||
Map user = {
|
||||
@@ -62,19 +61,26 @@ class PhoneController extends AbstractController {
|
||||
if(response['state'] == 'failed') {
|
||||
model.errorMessage = response['message'];
|
||||
showErrorSnackBar(model.errorMessage);
|
||||
model.isLoading = false;
|
||||
notifyListeners();
|
||||
return ApiResponse.failure(response['message'] ?? "Registration failed");
|
||||
}
|
||||
Map body = response['body'];
|
||||
body['workflowId'] = response['workflowId'];
|
||||
onboardingController.updateModel(body);
|
||||
|
||||
model.isLoading = false;
|
||||
notifyListeners();
|
||||
return ApiResponse.success(Map<String, dynamic>.from(body));
|
||||
} catch (e) {
|
||||
logger.e(e);
|
||||
showErrorSnackBar(
|
||||
"Problem during registration, please try again or contact support?",
|
||||
);
|
||||
model.isLoading = false;
|
||||
notifyListeners();
|
||||
return ApiResponse.failure("Problem during registration, please try again or contact support?");
|
||||
}
|
||||
|
||||
model.isLoading = false;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user