feat(editor): ✨ Team workspaces
This commit is contained in:
@@ -6,14 +6,16 @@ import { sendRequest } from 'utils'
|
||||
|
||||
export const useFolders = ({
|
||||
parentId,
|
||||
workspaceId,
|
||||
onError,
|
||||
}: {
|
||||
workspaceId?: string
|
||||
parentId?: string
|
||||
onError: (error: Error) => void
|
||||
}) => {
|
||||
const params = stringify({ parentId })
|
||||
const params = stringify({ parentId, workspaceId })
|
||||
const { data, error, mutate } = useSWR<{ folders: DashboardFolder[] }, Error>(
|
||||
`/api/folders?${params}`,
|
||||
workspaceId ? `/api/folders?${params}` : null,
|
||||
fetcher,
|
||||
{ dedupingInterval: process.env.NEXT_PUBLIC_E2E_TEST ? 0 : undefined }
|
||||
)
|
||||
@@ -45,12 +47,13 @@ export const useFolderContent = ({
|
||||
}
|
||||
|
||||
export const createFolder = async (
|
||||
workspaceId: string,
|
||||
folder: Pick<DashboardFolder, 'parentFolderId'>
|
||||
) =>
|
||||
sendRequest<DashboardFolder>({
|
||||
url: `/api/folders`,
|
||||
method: 'POST',
|
||||
body: folder,
|
||||
body: { ...folder, workspaceId },
|
||||
})
|
||||
|
||||
export const deleteFolder = async (id: string) =>
|
||||
|
||||
Reference in New Issue
Block a user