From 5172bceec3f34b10ef4e96da0a6b659ccaee1f07 Mon Sep 17 00:00:00 2001 From: Sagar Jaglan <87278039+imjaglan@users.noreply.github.com> Date: Tue, 9 Jan 2024 02:46:00 +0530 Subject: [PATCH] #520 fixed unauthorized token error (#535) --- frontend/src/components/DefaultChat/index.jsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/DefaultChat/index.jsx b/frontend/src/components/DefaultChat/index.jsx index ca29b4700..8bc6c7cb7 100644 --- a/frontend/src/components/DefaultChat/index.jsx +++ b/frontend/src/components/DefaultChat/index.jsx @@ -16,9 +16,11 @@ import System from "@/models/system"; import Jazzicon from "../UserIcon"; import { userFromStorage } from "@/utils/request"; import { AI_BACKGROUND_COLOR, USER_BACKGROUND_COLOR } from "@/utils/constants"; +import useUser from "@/hooks/useUser"; export default function DefaultChatContainer() { const [mockMsgs, setMockMessages] = useState([]); + const { user } = useUser(); const [fetchedMessages, setFetchedMessages] = useState([]); const { showing: showingNewWsModal, @@ -163,13 +165,15 @@ export default function DefaultChatContainer() { You can add and remove files at anytime. </span> - <button - onClick={showNewWsModal} - className="mt-5 w-fit transition-all duration-300 border border-slate-200 px-4 py-2 rounded-lg text-white text-sm items-center flex gap-x-2 hover:bg-slate-200 hover:text-slate-800 focus:ring-gray-800" - > - <Plus className="h-4 w-4" /> - <p>Create your first workspace</p> - </button> + {(!user || user?.role !== "default") && ( + <button + onClick={showNewWsModal} + className="mt-5 w-fit transition-all duration-300 border border-slate-200 px-4 py-2 rounded-lg text-white text-sm items-center flex gap-x-2 hover:bg-slate-200 hover:text-slate-800 focus:ring-gray-800" + > + <Plus className="h-4 w-4" /> + <p>Create your first workspace</p> + </button> + )} </div> </div> </div> -- GitLab