Files
ncd-fe/src/api/hooks/statuses/useUpdateBookmarkFolder.ts
marcin mikołajczak 32c68a9221 Migrate to external library for interacting with API
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-08-06 19:52:36 +02:00

28 lines
745 B
TypeScript

import { Entities } from 'soapbox/entity-store/entities';
import { useCreateEntity } from 'soapbox/entity-store/hooks';
import { useClient } from 'soapbox/hooks';
import { bookmarkFolderSchema } from 'soapbox/schemas/bookmark-folder';
interface UpdateBookmarkFolderParams {
name: string;
emoji?: string;
}
const useUpdateBookmarkFolder = (folderId: string) => {
const client = useClient();
const { createEntity, ...rest } = useCreateEntity(
[Entities.BOOKMARK_FOLDERS],
(params: UpdateBookmarkFolderParams) =>
client.myAccount.updateBookmarkFolder(folderId, params),
{ schema: bookmarkFolderSchema },
);
return {
updateBookmarkFolder: createEntity,
...rest,
};
};
export { useUpdateBookmarkFolder };