63 行
1.6 KiB
TypeScript
63 行
1.6 KiB
TypeScript
import { apiRequestData } from "./http";
|
|
|
|
export type WorkspaceModuleVisibilityMode = "main" | "admin" | "hidden";
|
|
|
|
export type WorkspaceSettings = {
|
|
id: string | null;
|
|
persisted: boolean;
|
|
profile: "small_team_internal";
|
|
orgMode: "single_company";
|
|
primaryEntryMode: "password";
|
|
notificationStrategy: "in_app";
|
|
devicePriority: "desktop";
|
|
moduleVisibility: Record<string, WorkspaceModuleVisibilityMode>;
|
|
createdAt: string | null;
|
|
updatedAt: string | null;
|
|
updatedBy: string | null;
|
|
defaults?: Record<string, WorkspaceModuleVisibilityMode>;
|
|
};
|
|
|
|
export type NavigationItem = {
|
|
key: string;
|
|
label: string;
|
|
icon: string;
|
|
href: string;
|
|
placement: WorkspaceModuleVisibilityMode;
|
|
permissionCodes: string[];
|
|
featureFlagKey: string | null;
|
|
};
|
|
|
|
export type RolePreset = {
|
|
key: string;
|
|
label: string;
|
|
roleCodes: string[];
|
|
description: string;
|
|
};
|
|
|
|
export type NavigationPayload = {
|
|
workspace: WorkspaceSettings;
|
|
sections: {
|
|
main: NavigationItem[];
|
|
admin: NavigationItem[];
|
|
backup: NavigationItem[];
|
|
};
|
|
recommendedRolePresets: RolePreset[];
|
|
};
|
|
|
|
export async function fetchWorkspaceSettings() {
|
|
return apiRequestData<WorkspaceSettings>("/api/system/workspace");
|
|
}
|
|
|
|
export async function updateWorkspaceSettings(payload: {
|
|
moduleVisibility: Record<string, WorkspaceModuleVisibilityMode>;
|
|
}) {
|
|
return apiRequestData<{ item: WorkspaceSettings }>("/api/system/workspace", {
|
|
method: "PATCH",
|
|
body: JSON.stringify(payload),
|
|
});
|
|
}
|
|
|
|
export async function fetchSystemNavigation() {
|
|
return apiRequestData<NavigationPayload>("/api/system/navigation");
|
|
}
|