This commit is contained in:
saeid
2019-05-06 21:48:46 +04:30
parent 5d8500dafd
commit f6d7277ddc
14 changed files with 268 additions and 168 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
import { ApiService } from "../global/api.service";
import { TokenService } from "./storage.service";
import { urls } from "@/config/urls";
import toast from "../global/toast.service";
class AuthenticationError extends Error {
constructor(errorCode, message) {
@@ -42,8 +43,9 @@ const UserService = {
// NOTE: We haven't covered this yet in our ApiService
// but don't worry about this just yet - I'll come back to it later
ApiService.mount401Interceptor();
return response.data.access_token;
return response;
} catch (error) {
toast.error('Username Or Password Is Incorrect', 'Error');
throw new AuthenticationError(
error.response.status,
error.response.data.detail