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

Fix billing modal not closing on success (#4558)

Mauricio Araujo 2 лет назад
Родитель
Сommit
283b54c27e
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      dashboard/src/main/home/Home.tsx

+ 5 - 3
dashboard/src/main/home/Home.tsx

@@ -215,7 +215,7 @@ const Home: React.FC<Props> = (props) => {
       } else {
         setHasFinishedOnboarding(true);
       }
-    } catch (error) {}
+    } catch (error) { }
   };
 
   useEffect(() => {
@@ -369,7 +369,7 @@ const Home: React.FC<Props> = (props) => {
   };
 
   const { cluster, baseRoute } = props.match.params as any;
-  const { hasPaymentEnabled } = checkIfProjectHasPayment();
+  const { hasPaymentEnabled, refetchPaymentEnabled } = checkIfProjectHasPayment();
   const { plan } = useCustomerPlan();
 
   const isTrialExpired = (timestamp: string): boolean => {
@@ -377,7 +377,7 @@ const Home: React.FC<Props> = (props) => {
       return true;
     }
 
-    const diff = timeFrom("2024-04-17T00:00:00.000Z");
+    const diff = timeFrom(timestamp);
     if (diff.when === "future") {
       return false;
     }
@@ -426,6 +426,7 @@ const Home: React.FC<Props> = (props) => {
                     setShowBillingModal(false);
                   }}
                   onCreate={async () => {
+                    await refetchPaymentEnabled({ throwOnError: false, cancelRefetch: false });
                     setShowBillingModal(false);
                   }}
                 />
@@ -434,6 +435,7 @@ const Home: React.FC<Props> = (props) => {
                 <BillingModal
                   trialExpired
                   onCreate={async () => {
+                    await refetchPaymentEnabled({ throwOnError: false, cancelRefetch: false });
                     setShowBillingModal(false);
                   }}
                 />