fix: implement robust multi-phase synchronization and server-side reconciliation
This commit is contained in:
@@ -130,5 +130,59 @@ class BackendService {
|
||||
throw new Error(e.response?.data?.message || 'Failed to revoke all access');
|
||||
}
|
||||
}
|
||||
// --- Admin API ---
|
||||
async getAdminStats() {
|
||||
if (!this.token)
|
||||
return null;
|
||||
try {
|
||||
const response = await axios_1.default.get(`${this.url}/api/admin/stats`, { headers: this.headers });
|
||||
return response.data;
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
async getAdminUsers() {
|
||||
if (!this.token)
|
||||
return [];
|
||||
try {
|
||||
const response = await axios_1.default.get(`${this.url}/api/admin/users`, { headers: this.headers });
|
||||
return response.data;
|
||||
}
|
||||
catch (e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
async deleteUser(userId) {
|
||||
if (!this.token)
|
||||
return;
|
||||
try {
|
||||
await axios_1.default.delete(`${this.url}/api/admin/users/${userId}`, { headers: this.headers });
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(e.response?.data?.message || 'Failed to delete user');
|
||||
}
|
||||
}
|
||||
async getAdminAccounts() {
|
||||
if (!this.token)
|
||||
return [];
|
||||
try {
|
||||
const response = await axios_1.default.get(`${this.url}/api/admin/accounts`, { headers: this.headers });
|
||||
return response.data;
|
||||
}
|
||||
catch (e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
async forceRemoveAccount(steamId) {
|
||||
if (!this.token)
|
||||
return;
|
||||
try {
|
||||
await axios_1.default.delete(`${this.url}/api/admin/accounts/${steamId}`, { headers: this.headers });
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(e.response?.data?.message || 'Failed to remove account');
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.BackendService = BackendService;
|
||||
|
||||
Reference in New Issue
Block a user