Просмотр исходного кода

success put in-app-notification-settings

Shun Miyazawa 4 лет назад
Родитель
Сommit
49beba5f89
1 измененных файлов с 17 добавлено и 2 удалено
  1. 17 2
      packages/app/src/components/Me/InAppNotificationSettings.tsx

+ 17 - 2
packages/app/src/components/Me/InAppNotificationSettings.tsx

@@ -3,16 +3,32 @@ import { useTranslation } from 'react-i18next';
 
 
 import AppContainer from '~/client/services/AppContainer';
 import AppContainer from '~/client/services/AppContainer';
 import { withUnstatedContainers } from '../UnstatedUtils';
 import { withUnstatedContainers } from '../UnstatedUtils';
+import { toastSuccess, toastError } from '~/client/util/apiNotification';
 
 
 type Props = {
 type Props = {
   appContainer: AppContainer,
   appContainer: AppContainer,
 };
 };
 
 
 const InAppNotificationSetting: FC<Props> = (props: Props) => {
 const InAppNotificationSetting: FC<Props> = (props: Props) => {
+  const { appContainer } = props;
   const { t } = useTranslation();
   const { t } = useTranslation();
 
 
-  const updateSettingsHandler = () => {
+  const updateSettingsHandler = async() => {
+
+    const defaultSubscribeRules = [
+      { name: 'PAGE_CREATE', isEnabled: true },
+    ];
+
     // TODO: 80102
     // TODO: 80102
+    try {
+      const res = await appContainer.apiv3Put('/personal-setting/in-app-notification-settings', { defaultSubscribeRules });
+      console.log(res);
+      toastSuccess('yoyoyo!');
+    }
+    catch (err) {
+      toastError(err);
+    }
+
     return;
     return;
   };
   };
 
 
@@ -20,7 +36,6 @@ const InAppNotificationSetting: FC<Props> = (props: Props) => {
     <>
     <>
       <h2 className="border-bottom my-4">{t('in_app_notification_settings.in_app_notification_settings')}</h2>
       <h2 className="border-bottom my-4">{t('in_app_notification_settings.in_app_notification_settings')}</h2>
 
 
-
       <div className="row my-3">
       <div className="row my-3">
         <div className="offset-4 col-5">
         <div className="offset-4 col-5">
           <button
           <button