first commit
This commit is contained in:
29
web/src/app/core/services/admin.service.ts
Normal file
29
web/src/app/core/services/admin.service.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import type { AppSettings, User } from '../../shared/models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AdminService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getSettings() {
|
||||
return this.http.get<{ item: AppSettings }>(`${environment.apiBaseUrl}/admin/settings`);
|
||||
}
|
||||
|
||||
updateSettings(payload: Partial<AppSettings>) {
|
||||
return this.http.put<{ item: AppSettings }>(`${environment.apiBaseUrl}/admin/settings`, payload);
|
||||
}
|
||||
|
||||
listUsers() {
|
||||
return this.http.get<{ items: User[] }>(`${environment.apiBaseUrl}/admin/users`);
|
||||
}
|
||||
|
||||
updateUser(id: string, payload: Partial<User>) {
|
||||
return this.http.patch<{ item: User }>(`${environment.apiBaseUrl}/admin/users/${id}`, payload);
|
||||
}
|
||||
|
||||
testSmtp(to: string) {
|
||||
return this.http.post<{ message: string }>(`${environment.apiBaseUrl}/admin/test-smtp`, { to });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user