|
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
import UserPictureList from './User/UserPictureList';
|
|
import UserPictureList from './User/UserPictureList';
|
|
|
import { toastError } from '~/client/util/apiNotification';
|
|
import { toastError } from '~/client/util/apiNotification';
|
|
|
-import { useIsGuestUser } from '~/stores/context';
|
|
|
|
|
|
|
+import { usePageId, useIsGuestUser } from '~/stores/context';
|
|
|
import { apiv3Put } from '~/client/util/apiv3-client';
|
|
import { apiv3Put } from '~/client/util/apiv3-client';
|
|
|
|
|
|
|
|
interface Props {
|
|
interface Props {
|
|
@@ -15,10 +15,10 @@ interface Props {
|
|
|
|
|
|
|
|
const LikeButtons: FC<Props> = (props: Props) => {
|
|
const LikeButtons: FC<Props> = (props: Props) => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
- const { pageId } = props;
|
|
|
|
|
|
|
|
|
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
|
|
|
|
|
|
|
|
+ const { data: pageId } = usePageId();
|
|
|
const { data: isGuestUser } = useIsGuestUser();
|
|
const { data: isGuestUser } = useIsGuestUser();
|
|
|
|
|
|
|
|
// TODO: Get the following values in SWR
|
|
// TODO: Get the following values in SWR
|
|
@@ -37,8 +37,7 @@ const LikeButtons: FC<Props> = (props: Props) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
- const res = await apiv3Put('/page/likes', { pageId, bool: isLiked });
|
|
|
|
|
|
|
+ await apiv3Put('/page/likes', { pageId, bool: isLiked });
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
toastError(err);
|
|
toastError(err);
|