mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 09:27:56 +00:00
count_down_ac
This commit is contained in:
@@ -63,6 +63,8 @@ abstract class ApiEndpoints {
|
||||
static const String unitUser = '/unit/user/';
|
||||
static const String invitationCode =
|
||||
'/projects/{projectUuid}/communities/{communityUuid}/spaces/{unitUuid}/invitation-code';
|
||||
static const String activationCode =
|
||||
'/invite-user/activation';
|
||||
|
||||
//PUT
|
||||
static const String renameUnit = '/unit/{unitUuid}';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
||||
|
||||
@@ -31,8 +31,10 @@ class ServerFailure extends Failure {
|
||||
{
|
||||
// var document = parser.parse(dioError.response!.data.toString());
|
||||
// var message = document.body!.text;
|
||||
return ServerFailure.fromResponse(dioError.response!.statusCode!,
|
||||
dioError.response?.data['error']['message'] ?? "Something went wrong");
|
||||
return ServerFailure.fromResponse(
|
||||
dioError.response!.statusCode!,
|
||||
dioError.response?.data['error']['message'] ??
|
||||
"Something went wrong");
|
||||
}
|
||||
case DioExceptionType.cancel:
|
||||
return ServerFailure("The request to ApiServer was canceled");
|
||||
@@ -54,15 +56,7 @@ class ServerFailure extends Failure {
|
||||
case 403:
|
||||
return ServerFailure(responseMessage);
|
||||
case 400:
|
||||
List<String> errors = [];
|
||||
if (responseMessage is List) {
|
||||
for (var error in responseMessage) {
|
||||
errors.add(error);
|
||||
}
|
||||
} else {
|
||||
return ServerFailure(responseMessage);
|
||||
}
|
||||
return ServerFailure(errors.join('\n'));
|
||||
return ServerFailure(responseMessage);
|
||||
case 404:
|
||||
return ServerFailure("");
|
||||
case 500:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
||||
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
||||
@@ -95,4 +96,21 @@ class SpacesAPI {
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
static Future activationCodeSpace({
|
||||
String? activationCode,
|
||||
String? userUuid,
|
||||
}) async {
|
||||
Map body = {"activationCode": activationCode, "userUuid": userUuid};
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.activationCode,
|
||||
showServerMessage: true,
|
||||
body: body,
|
||||
expectedResponseModel: (json) {
|
||||
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user