feat: implement comprehensive admin dashboard for server management and user oversight
This commit is contained in:
@@ -119,4 +119,48 @@ export class BackendService {
|
||||
throw new Error(e.response?.data?.message || 'Failed to revoke all access');
|
||||
}
|
||||
}
|
||||
|
||||
// --- Admin API ---
|
||||
|
||||
public async getAdminStats() {
|
||||
if (!this.token) return null;
|
||||
try {
|
||||
const response = await axios.get(`${this.url}/api/admin/stats`, { headers: this.headers });
|
||||
return response.data;
|
||||
} catch (e) { return null; }
|
||||
}
|
||||
|
||||
public async getAdminUsers() {
|
||||
if (!this.token) return [];
|
||||
try {
|
||||
const response = await axios.get(`${this.url}/api/admin/users`, { headers: this.headers });
|
||||
return response.data;
|
||||
} catch (e) { return []; }
|
||||
}
|
||||
|
||||
public async deleteUser(userId: string) {
|
||||
if (!this.token) return;
|
||||
try {
|
||||
await axios.delete(`${this.url}/api/admin/users/${userId}`, { headers: this.headers });
|
||||
} catch (e: any) {
|
||||
throw new Error(e.response?.data?.message || 'Failed to delete user');
|
||||
}
|
||||
}
|
||||
|
||||
public async getAdminAccounts() {
|
||||
if (!this.token) return [];
|
||||
try {
|
||||
const response = await axios.get(`${this.url}/api/admin/accounts`, { headers: this.headers });
|
||||
return response.data;
|
||||
} catch (e) { return []; }
|
||||
}
|
||||
|
||||
public async forceRemoveAccount(steamId: string) {
|
||||
if (!this.token) return;
|
||||
try {
|
||||
await axios.delete(`${this.url}/api/admin/accounts/${steamId}`, { headers: this.headers });
|
||||
} catch (e: any) {
|
||||
throw new Error(e.response?.data?.message || 'Failed to remove account');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user