31 lines
710 B
TypeScript
31 lines
710 B
TypeScript
import { adminRequest } from "@/lib/admin-http";
|
|
import { API_V1_PREFIX } from "@/api/paths";
|
|
|
|
const A = `${API_V1_PREFIX}/admin`;
|
|
|
|
export type AdminSettingItem = {
|
|
key: string;
|
|
value: unknown;
|
|
group: string;
|
|
description: string | null;
|
|
};
|
|
|
|
export type AdminSettingListResponse = {
|
|
items: AdminSettingItem[];
|
|
};
|
|
|
|
export async function getAdminSettings(
|
|
group: string,
|
|
): Promise<AdminSettingListResponse> {
|
|
return adminRequest.get<AdminSettingListResponse>(`${A}/settings`, {
|
|
params: { group },
|
|
});
|
|
}
|
|
|
|
export async function updateAdminSetting(
|
|
key: string,
|
|
value: unknown,
|
|
): Promise<AdminSettingItem> {
|
|
return adminRequest.put<AdminSettingItem>(`${A}/settings/${key}`, { value });
|
|
}
|