refactor: Authentication service.

This commit is contained in:
Ahmed Bouhuolia
2020-08-31 22:15:44 +02:00
parent ca251a2d28
commit abefba22ee
35 changed files with 880 additions and 395 deletions

View File

@@ -0,0 +1,11 @@
export default class ServiceError {
errorType: string;
message: string;
constructor(errorType: string, message?: string) {
this.errorType = errorType;
this.message = message || null;
}
}

View File

@@ -0,0 +1,15 @@
import ServiceError from './ServiceError';
export default class ServiceErrors {
errors: ServiceError[];
constructor(errors: ServiceError[]) {
this.errors = errors;
}
hasType(errorType: string) {
return this.errors
.filter((error: ServiceError) => error.errorType === errorType);
}
}

View File

@@ -1,5 +1,9 @@
import NotAllowedChangeSubscriptionPlan from './NotAllowedChangeSubscriptionPlan';
import ServiceError from './ServiceError';
import ServiceErrors from './ServiceErrors';
export {
NotAllowedChangeSubscriptionPlan,
ServiceError,
ServiceErrors,
};