yohei0125 %!s(int64=3) %!d(string=hai) anos
pai
achega
67d7c5cd64
Modificáronse 1 ficheiros con 10 adicións e 6 borrados
  1. 10 6
      packages/app/src/components/PageAlert/PageRedirectedAlert.tsx

+ 10 - 6
packages/app/src/components/PageAlert/PageRedirectedAlert.tsx

@@ -1,20 +1,24 @@
-import React, { useState } from 'react';
+import React, { useState, useCallback } from 'react';
 
 import { useTranslation } from 'next-i18next';
 
-import { useRedirectFrom } from '~/stores/context';
+import { apiPost } from '~/client/util/apiv1-client';
+import { useCurrentPagePath, useRedirectFrom } from '~/stores/context';
 
 export const PageRedirectedAlert = React.memo((): JSX.Element => {
   const { t } = useTranslation();
+
   const { data: redirectFrom } = useRedirectFrom();
+  const { data: currentPagePath } = useCurrentPagePath();
+
   const [isUnlinked, setIsUnlinked] = useState(false);
 
-  const unlinkButtonClickHandler = (): void => {
-    // Todo: implement in https://redmine.weseek.co.jp/issues/101741
+  const unlinkButtonClickHandler = useCallback(() => {
+    apiPost('/pages.unlink', { path: currentPagePath });
     setIsUnlinked(true);
-  };
+  }, [currentPagePath]);
 
-  if (!redirectFrom) {
+  if (redirectFrom == null) {
     return <></>;
   }