aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/services
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-08-31 01:50:40 +0800
committercrupest <crupest@outlook.com>2023-08-31 01:50:40 +0800
commitfb64a8f3d4a7dd4035f50ccf2601ae0a683bd1b8 (patch)
tree499e15e9567eae52ed043b8eaf99ddf33db05311 /FrontEnd/src/services
parent9c69024cf5961c3c71fb58e4237f09a513d195b1 (diff)
downloadtimeline-fb64a8f3d4a7dd4035f50ccf2601ae0a683bd1b8.tar.gz
timeline-fb64a8f3d4a7dd4035f50ccf2601ae0a683bd1b8.tar.bz2
timeline-fb64a8f3d4a7dd4035f50ccf2601ae0a683bd1b8.zip
...
Diffstat (limited to 'FrontEnd/src/services')
-rw-r--r--FrontEnd/src/services/user.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/FrontEnd/src/services/user.ts b/FrontEnd/src/services/user.ts
index ddba4dab..5f682a36 100644
--- a/FrontEnd/src/services/user.ts
+++ b/FrontEnd/src/services/user.ts
@@ -8,14 +8,17 @@ import { setHttpToken, axios, HttpBadRequestError } from "~src/http/common";
import { getHttpTokenClient } from "~src/http/token";
import { getHttpUserClient, HttpUser, UserPermission } from "~src/http/user";
-import { pushAlert } from "./alert";
+import { pushAlert } from "~src/components/alert";
interface IAuthUser extends HttpUser {
token: string;
}
export class AuthUser implements IAuthUser {
- constructor(user: HttpUser, public token: string) {
+ constructor(
+ user: HttpUser,
+ public token: string,
+ ) {
this.uniqueId = user.uniqueId;
this.username = user.username;
this.permissions = user.permissions;
@@ -61,7 +64,7 @@ export class UserService {
if (e.isAxiosError && e.response && e.response.status === 401) {
this.userSubject.next(null);
pushAlert({
- type: "danger",
+ color: "danger",
message: "user.tokenInvalid",
});
} else {
@@ -97,11 +100,11 @@ export class UserService {
localStorage.removeItem(USER_STORAGE_KEY);
this.userSubject.next(null);
pushAlert({
- type: "danger",
+ color: "danger",
message: "user.tokenInvalid",
});
}
- }
+ },
);
}
}
@@ -118,7 +121,7 @@ export class UserService {
async login(
credentials: LoginCredentials,
- rememberMe: boolean
+ rememberMe: boolean,
): Promise<void> {
if (this.currentUser) {
throw new UiLogicError("Already login.");