From e936bb6f15d4207150b6ec35340690601f5407d9 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 25 Sep 2023 06:08:30 +0800 Subject: [PATCH] chore: update subscription permission --- frontend/web/src/pages/SubscriptionSetting.tsx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/frontend/web/src/pages/SubscriptionSetting.tsx b/frontend/web/src/pages/SubscriptionSetting.tsx index f61ca63..16429b1 100644 --- a/frontend/web/src/pages/SubscriptionSetting.tsx +++ b/frontend/web/src/pages/SubscriptionSetting.tsx @@ -1,5 +1,5 @@ import { Alert, Button, Divider, Link, Textarea } from "@mui/joy"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import toast from "react-hot-toast"; import Icon from "@/components/Icon"; import SubscriptionFAQ from "@/components/SubscriptionFAQ"; @@ -16,17 +16,12 @@ const SubscriptionSetting: React.FC = () => { const isAdmin = currentUser.role === "ADMIN"; const profile = workspaceStore.profile; - useEffect(() => { - if (!isAdmin) { - window.location.href = "/"; - } - }, []); - - if (!isAdmin) { - return null; - } - const handleUpdateLicenseKey = async () => { + if (!isAdmin) { + toast.error("Only admin can upload license key"); + return; + } + try { const { subscription } = await subscriptionServiceClient.updateSubscription({ licenseKey,