[WEB-1634] dev: update application router to support n-progress. (#4846)

* [WEB-1634] dev: update application router to support n-progress.

* chore: update app router initilization logic.

* fix: lint errors
This commit is contained in:
Prateek Shourya 2024-06-18 11:35:20 +05:30 committed by GitHub
parent 10e67144a0
commit 6828d33c3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
111 changed files with 480 additions and 374 deletions

View file

@ -2,7 +2,7 @@
import { FC, ReactNode } from "react";
import { observer } from "mobx-react";
import { useRouter, useSearchParams, usePathname } from "next/navigation";
import { useSearchParams, usePathname } from "next/navigation";
import useSWR from "swr";
// components
import { LogoSpinner } from "@/components/common";
@ -10,6 +10,7 @@ import { LogoSpinner } from "@/components/common";
import { EPageTypes } from "@/helpers/authentication.helper";
// hooks
import { useUser, useUserProfile, useUserSettings, useWorkspace } from "@/hooks/store";
import { useAppRouter } from "@/hooks/use-app-router";
type TPageType = EPageTypes;
@ -25,7 +26,7 @@ const isValidURL = (url: string): boolean => {
export const AuthenticationWrapper: FC<TAuthenticationWrapper> = observer((props) => {
const pathname = usePathname();
const router = useRouter();
const router = useAppRouter();
const searchParams = useSearchParams();
const nextPath = searchParams.get("next_path");
// props

View file

@ -5,7 +5,7 @@ import { useTheme } from "next-themes";
// helpers
import { applyTheme, unsetCustomCssVariables } from "@/helpers/theme.helper";
// hooks
import { useAppRouter, useAppTheme, useUserProfile } from "@/hooks/store";
import { useRouterParams, useAppTheme, useUserProfile } from "@/hooks/store";
type TStoreWrapper = {
children: ReactNode;
@ -18,7 +18,7 @@ const StoreWrapper: FC<TStoreWrapper> = observer((props) => {
// router
const params = useParams();
// store hooks
const { setQuery } = useAppRouter();
const { setQuery } = useRouterParams();
const { sidebarCollapsed, toggleSidebar } = useAppTheme();
const { data: userProfile } = useUserProfile();
// states