|
|
@@ -2,6 +2,7 @@ import React, { useState, useCallback } from 'react';
|
|
|
|
|
|
import { useTranslation } from 'next-i18next';
|
|
|
|
|
|
+import { toastError } from '~/client/util/apiNotification';
|
|
|
import { useCurrentPagePath } from '~/stores/context';
|
|
|
import { useRedirectFrom } from '~/stores/page-redirect';
|
|
|
|
|
|
@@ -12,12 +13,15 @@ export const PageRedirectedAlert = React.memo((): JSX.Element => {
|
|
|
|
|
|
const [isUnlinked, setIsUnlinked] = useState(false);
|
|
|
|
|
|
- const unlinkButtonClickHandler = useCallback(() => {
|
|
|
+ const unlinkButtonClickHandler = useCallback(async() => {
|
|
|
if (currentPagePath == null) return;
|
|
|
-
|
|
|
- unlink(currentPagePath);
|
|
|
- setIsUnlinked(true);
|
|
|
-
|
|
|
+ try {
|
|
|
+ await unlink(currentPagePath);
|
|
|
+ setIsUnlinked(true);
|
|
|
+ }
|
|
|
+ catch (err) {
|
|
|
+ toastError(err);
|
|
|
+ }
|
|
|
}, [currentPagePath, unlink]);
|
|
|
|
|
|
if (redirectFrom == null) {
|