mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Add Docker support.
This commit is contained in:
@@ -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`, {
|
||||
|
Reference in New Issue
Block a user