Skip to content

Commit

Permalink
Extract default tab into a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Made1ra committed Nov 26, 2024
1 parent 02b1455 commit 9284337
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ const CooperationDetails = () => {

const isTabInSearchParams = Object.values(CooperationTabsEnum).includes(tab)

const activeTab = isTabInSearchParams ? tab : CooperationTabsEnum.Activities
const defaultTab = CooperationTabsEnum.Activities

const activeTab = isTabInSearchParams ? tab : defaultTab

useEffect(() => {
if (!isTabInSearchParams) {
setSearchParams({ tab: CooperationTabsEnum.Activities })
setSearchParams({ tab: defaultTab })
}
}, [isTabInSearchParams, setSearchParams])
}, [defaultTab, isTabInSearchParams, setSearchParams])

const responseError = useCallback(
() => navigate(errorRoutes.notFound.path),
Expand Down

0 comments on commit 9284337

Please sign in to comment.