Skip to content

Commit 8c0b06b

Browse files
committed
update
1 parent 09bd438 commit 8c0b06b

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

bytbox_app/lib/api/backend_api_client.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import 'package:path_provider/path_provider.dart';
1111

1212
class BackendApiClient {
1313
final String url = dotenv.env['BACKEND_URL']!;
14+
1415
final _storage = FlutterSecureStorage();
1516

1617
Future<Map<String,dynamic>> registerUser({
@@ -19,6 +20,7 @@ class BackendApiClient {
1920
required String password,
2021
File? file,
2122
String? profilurl,
23+
bool? gg,
2224
}) async {
2325
final uri = Uri.parse('$url/user/signup');
2426
final request = http.MultipartRequest('POST', uri);
@@ -45,13 +47,16 @@ class BackendApiClient {
4547
final responseBody = await response.stream.bytesToString();
4648
final body = jsonDecode(responseBody);
4749
if(response.statusCode != 200 && response.statusCode!=201){
48-
if(profilurl != null && response.statusCode==202){
50+
if(profilurl != null && response.statusCode==202 || gg == true){
4951
return jsonDecode(responseBody);
5052
}
5153
if(response.statusCode==202){
52-
throw Exception('users already exist');
54+
if(gg == true){
55+
return jsonDecode(responseBody);
56+
}
57+
throw Exception('users already exist2222');
5358
}
54-
throw Exception(body['message'] ?? 'Something went wrong');
59+
throw Exception(body['message'] ?? 'Something went wron222g');
5560
}
5661
return jsonDecode(responseBody);
5762
}
@@ -70,13 +75,16 @@ class BackendApiClient {
7075
'password': password,
7176
}),
7277
);
78+
print(email);
7379
final responseBody = jsonDecode(response.body);
7480
if(response.statusCode != 200 && response.statusCode!=201){
7581
if(response.statusCode==202){
7682
throw Exception( 'Something went wrong');
7783
}
7884
throw Exception('Something went wrong');
7985
}
86+
print('Something went wrong');
87+
print(responseBody);
8088
return responseBody;
8189
}
8290

bytbox_app/lib/backend_notifier/backend_notifier.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ class BackendNotifier extends AsyncNotifier <Map<String, dynamic>?> {
6767
name: user['name'],
6868
email: user['email'],
6969
password: user['password'],
70-
profilurl: user['picture']
70+
profilurl: user['picture'],
71+
gg: true
7172
);
7273
result['success']=true;
7374
final userid = result['user']['_id'];

bytbox_app/lib/utils/google_login.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ final GoogleSignIn _googleSignIn = GoogleSignIn(
77
Future<Map<String,dynamic>> signInWithGoogle() async {
88
final user = await _googleSignIn.signIn();
99
final auth = await user!.authentication;
10-
1110
final idToken = auth.accessToken;
1211
return {
1312
'name': user.displayName,

0 commit comments

Comments
 (0)