setting domain
This commit is contained in:
@@ -2,6 +2,7 @@ import { FC, useEffect, useState } from 'react'
|
||||
import { useWorkspaces } from './hooks/useHomeData'
|
||||
import { workspaceItem } from './types/HomeTypes'
|
||||
import moment from 'moment-jalaali'
|
||||
import { toast } from 'react-toastify'
|
||||
|
||||
const Home: FC = () => {
|
||||
|
||||
@@ -12,6 +13,20 @@ const Home: FC = () => {
|
||||
setSelectedWorkspace(localStorage.getItem(import.meta.env.VITE_WORKSPACE_ID))
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (getWorkspaces.isError && getWorkspaces.error instanceof Error) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const error = getWorkspaces.error as any;
|
||||
if (error.response?.status === 403) {
|
||||
toast.error(error.response?.data?.error.message[0])
|
||||
localStorage.removeItem(import.meta.env.VITE_WORKSPACE_ID)
|
||||
window.location.href = 'https://console.danakcorp.com'
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [getWorkspaces.isError, getWorkspaces.data])
|
||||
|
||||
|
||||
const handleChangeWorkspace = (id: string) => {
|
||||
localStorage.setItem(import.meta.env.VITE_WORKSPACE_ID, id)
|
||||
setSelectedWorkspace(id)
|
||||
|
||||
Reference in New Issue
Block a user