refactor phase 7-8
This commit is contained in:
@@ -1580,6 +1580,50 @@ export async function deleteAccountSetting(key: string): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
// User Settings API functions
|
||||
export interface UserSetting {
|
||||
id: number;
|
||||
key: string;
|
||||
value: Record<string, any>;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface UserSettingsResponse {
|
||||
count: number;
|
||||
next: string | null;
|
||||
previous: string | null;
|
||||
results: UserSetting[];
|
||||
}
|
||||
|
||||
export async function fetchUserSettings(): Promise<UserSettingsResponse> {
|
||||
return fetchAPI('/v1/system/settings/user/');
|
||||
}
|
||||
|
||||
export async function fetchUserSetting(key: string): Promise<UserSetting> {
|
||||
return fetchAPI(`/v1/system/settings/user/${key}/`);
|
||||
}
|
||||
|
||||
export async function createUserSetting(data: { key: string; value: Record<string, any> }): Promise<UserSetting> {
|
||||
return fetchAPI('/v1/system/settings/user/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateUserSetting(key: string, data: { value: Record<string, any> }): Promise<UserSetting> {
|
||||
return fetchAPI(`/v1/system/settings/user/${key}/`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteUserSetting(key: string): Promise<void> {
|
||||
await fetchAPI(`/v1/system/settings/user/${key}/`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
// Module Settings
|
||||
export interface ModuleEnableSettings {
|
||||
id: number;
|
||||
|
||||
Reference in New Issue
Block a user