From 9a80c0a767c6a35a489b9d45654ae60f7ddc6794 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 4 Jul 2024 11:53:01 +0700 Subject: update stock opname logic --- src/modules/result/components/MoreMenu.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/modules/result/components/MoreMenu.tsx') diff --git a/src/modules/result/components/MoreMenu.tsx b/src/modules/result/components/MoreMenu.tsx index 03c9786..cd4e8be 100644 --- a/src/modules/result/components/MoreMenu.tsx +++ b/src/modules/result/components/MoreMenu.tsx @@ -1,16 +1,29 @@ "use client"; import { Button, Dropdown, DropdownItem, DropdownMenu, DropdownTrigger, useDisclosure } from '@nextui-org/react' import { MoreVerticalIcon } from 'lucide-react' -import React from 'react' +import React, { useState, useEffect } from 'react' import ImportModal from './ImportModal'; import ProductModal from './ProductModal'; import getClientCredential from '@/common/libs/getClientCredential'; +type Credential = { + team: string; +}; + const MoreMenu = () => { - const credential = getClientCredential() + const [credential, setCredential] = useState(null); const importModal = useDisclosure(); const productModal = useDisclosure(); + useEffect(() => { + const cred = getClientCredential(); + setCredential(cred); + }, []); + + if (!credential || credential.team !== 'VERIFICATION') { + return null; + } + return credential && credential.team == 'VERIFICATION' && ( <> -- cgit v1.2.3