Add Docker support.

This commit is contained in:
2025-05-15 16:21:20 +08:00
parent b270cc480e
commit 16d25f034e
7 changed files with 138 additions and 9 deletions

View File

@@ -27,6 +27,7 @@ class Network {
}
init() {
this.testToken()
if (import.meta.env.MODE === 'development') {
this.baseUrl = 'http://localhost:3000';
this.apiBaseUrl = 'http://localhost:3000/api';
@@ -58,6 +59,19 @@ class Network {
})
}
async testToken(): Promise<void> {
if (!app.token) {
return;
}
const res = await this.getUserInfo(app.user!.username)
if (!res.success) {
app.token = null;
app.user = null;
app.saveData();
window.location.reload();
}
}
async login(username: string, password: string): Promise<Response<UserWithToken>> {
try {
const response = await axios.postForm(`${this.apiBaseUrl}/user/login`, {