This commit is contained in:
@@ -16,6 +16,8 @@ export interface Space {
|
||||
workspaceDir: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
favorite?: boolean;
|
||||
hidden?: boolean;
|
||||
/** 閲覧者自身のメンバーロール。一覧(GET /spaces)・詳細(GET /spaces/:id)の両方で付与。
|
||||
* 非メンバー(根オーナー含む。owner_id はメンバー行ではない)は null。 */
|
||||
myRole?: SpaceMemberRole | null;
|
||||
@@ -28,6 +30,20 @@ export async function fetchSpaces(): Promise<Space[]> {
|
||||
return data as Space[];
|
||||
}
|
||||
|
||||
export async function updateSpaceDisplayPrefs(
|
||||
id: string,
|
||||
patch: { favorite?: boolean; hidden?: boolean },
|
||||
): Promise<{ favorite: boolean; hidden: boolean }> {
|
||||
const res = await fetch(`${BASE}/local/spaces/${id}/display`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(patch),
|
||||
});
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) throw new Error(data?.error ?? 'Failed to update workspace display settings');
|
||||
return data as { favorite: boolean; hidden: boolean };
|
||||
}
|
||||
|
||||
export type SpaceMemberRole = 'owner' | 'editor' | 'viewer';
|
||||
|
||||
export interface SpaceMember {
|
||||
|
||||
Reference in New Issue
Block a user