version 2.1.0 (#482)

This commit is contained in:
Sijie.Sun
2024-11-19 23:46:02 +08:00
committed by GitHub
parent 3f47f37470
commit 86600c6315
13 changed files with 45 additions and 29 deletions

View File

@@ -27,6 +27,7 @@
"primeicons": "^7.0.0",
"primevue": "^4.2.1",
"tailwindcss-primeui": "^0.3.4",
"ts-md5": "^1.3.1",
"uuid": "^11.0.2",
"vue": "^3.5.12",
"vue-i18n": "^10.0.4"

View File

@@ -1,4 +1,5 @@
import axios, { AxiosError, AxiosInstance, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
import { Md5 } from 'ts-md5'
export interface ValidateConfigResponse {
toml_config: string;
@@ -79,6 +80,7 @@ export class ApiClient {
// 注册
public async register(data: RegisterData): Promise<RegisterResponse> {
try {
data.credentials.password = Md5.hashStr(data.credentials.password);
const response = await this.client.post<RegisterResponse>('/auth/register', data);
console.log("register response:", response);
return { success: true, message: 'Register success', };
@@ -93,6 +95,7 @@ export class ApiClient {
// 登录
public async login(data: Credential): Promise<LoginResponse> {
try {
data.password = Md5.hashStr(data.password);
const response = await this.client.post<any>('/auth/login', data);
console.log("login response:", response);
return { success: true, message: 'Login success', };
@@ -116,7 +119,7 @@ export class ApiClient {
}
public async change_password(new_password: string) {
await this.client.put('/auth/password', { new_password: new_password });
await this.client.put('/auth/password', { new_password: Md5.hashStr(new_password) });
}
public async check_login_status() {