12345678910111213141516171819202122232425 |
- import { UserPreferencesDTO } from 'app/types';
- import { backendSrv } from './backend_srv';
- export class PreferencesService {
- constructor(private resourceUri: string) {}
- /**
- * Overrides all preferences
- */
- update(preferences: UserPreferencesDTO): Promise<any> {
- return backendSrv.put(`/api/${this.resourceUri}/preferences`, preferences);
- }
- /**
- * Updates only provided preferences
- */
- patch(preferences: Partial<UserPreferencesDTO>): Promise<any> {
- return backendSrv.patch(`/api/${this.resourceUri}/preferences`, preferences);
- }
- load(): Promise<UserPreferencesDTO> {
- return backendSrv.get<UserPreferencesDTO>(`/api/${this.resourceUri}/preferences`);
- }
- }
|