|
|
@@ -7,8 +7,6 @@ import { IPageHasId } from '~/interfaces/page';
|
|
|
import { apiv3Get } from '../client/util/apiv3-client';
|
|
|
import { IBookmarkInfo } from '../interfaces/bookmark-info';
|
|
|
|
|
|
-import { useCurrentUser } from './context';
|
|
|
-
|
|
|
export const useSWRBookmarkInfo = (pageId: string | null | undefined): SWRResponse<IBookmarkInfo, Error> => {
|
|
|
return useSWRImmutable(
|
|
|
pageId != null ? `/bookmarks/info?pageId=${pageId}` : null,
|
|
|
@@ -22,11 +20,11 @@ export const useSWRBookmarkInfo = (pageId: string | null | undefined): SWRRespon
|
|
|
);
|
|
|
};
|
|
|
|
|
|
-export const useSWRxCurrentUserBookmarks = (): SWRResponse<IPageHasId[], Error> => {
|
|
|
- const { data: currentUser } = useCurrentUser();
|
|
|
- const user = currentUser as IUserHasId;
|
|
|
+export const useSWRxCurrentUserBookmarks = (userId?: string): SWRResponse<IPageHasId[], Error> => {
|
|
|
+ // const { data: currentUser } = useCurrentUser();
|
|
|
+ // const user = currentUser as IUserHasId;
|
|
|
return useSWRImmutable(
|
|
|
- currentUser != null ? `/bookmarks/${user._id}` : null,
|
|
|
+ userId != null ? `/bookmarks/${userId}` : null,
|
|
|
endpoint => apiv3Get(endpoint).then((response) => {
|
|
|
const { userRootBookmarks } = response.data;
|
|
|
return userRootBookmarks.map((item) => {
|