Bookmark folders

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-03-20 23:58:53 +01:00
parent 460e22ce2b
commit eceafedec4
31 changed files with 748 additions and 60 deletions

View File

@ -0,0 +1,31 @@
import { Entities } from 'soapbox/entity-store/entities';
import { useCreateEntity } from 'soapbox/entity-store/hooks';
import { useApi } from 'soapbox/hooks';
import { bookmarkFolderSchema } from 'soapbox/schemas/bookmark-folder';
interface UpdateBookmarkFolderParams {
name: string;
emoji?: string;
}
function useUpdateBookmarkFolder(folderId: string) {
const api = useApi();
const { createEntity, ...rest } = useCreateEntity(
[Entities.BOOKMARK_FOLDERS],
(params: UpdateBookmarkFolderParams) =>
api.patch(`/api/v1/pleroma/bookmark_folders/${folderId}`, params, {
headers: {
'Content-Type': 'multipart/form-data',
},
}),
{ schema: bookmarkFolderSchema },
);
return {
updateBookmarkFolder: createEntity,
...rest,
};
}
export { useUpdateBookmarkFolder };