diff --git a/clients/mobile/app/_layout.tsx b/clients/mobile/app/_layout.tsx index cd2effd53..44af1c301 100644 --- a/clients/mobile/app/_layout.tsx +++ b/clients/mobile/app/_layout.tsx @@ -1,4 +1,4 @@ -import { Stack, Redirect } from "expo-router"; +import { Stack } from "expo-router"; import { StatusBar } from "expo-status-bar"; import { SafeAreaProvider } from "react-native-safe-area-context"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; @@ -11,12 +11,7 @@ import { } from "@react-navigation/native"; import { tokenCache } from "@clerk/clerk-expo/token-cache"; -import { - ClerkProvider, - ClerkLoaded, - useAuth, - useOrganization, -} from "@clerk/clerk-expo"; +import { ClerkProvider, ClerkLoaded, useAuth } from "@clerk/clerk-expo"; import { useColorScheme } from "@/hooks/use-color-scheme"; import { setConfig } from "@shared"; @@ -38,17 +33,9 @@ export const unstable_settings = { // Component to configure auth provider and the api base url function AppConfigurator() { const { getToken } = useAuth(); - const { organization } = useOrganization(); - const hotelId = organization?.publicMetadata?.hotel_id; - - if (!hotelId) { - return ; - } - setConfig({ API_BASE_URL: process.env.EXPO_PUBLIC_API_BASE_URL ?? "", getToken, - hotelId: hotelId as string, }); return null; } diff --git a/clients/mobile/app/no-org.tsx b/clients/mobile/app/no-org.tsx deleted file mode 100644 index 137b7b7ac..000000000 --- a/clients/mobile/app/no-org.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { View, Text } from "react-native"; - -export default function NoOrg() { - return ( - - - No Organization Found - - - ); -} diff --git a/clients/shared/src/api/client.ts b/clients/shared/src/api/client.ts index 4da8b4fbf..648ae378f 100644 --- a/clients/shared/src/api/client.ts +++ b/clients/shared/src/api/client.ts @@ -7,8 +7,8 @@ import { getConfig } from "./config"; export const createRequest = ( getToken: () => Promise, baseUrl: string, - hotelId: string, ) => { + const hardCodedHotelId = "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11" return async (config: RequestConfig): Promise => { let fullUrl = `${baseUrl}${config.url}`; if (config.params && Object.keys(config.params).length > 0) { @@ -24,7 +24,7 @@ export const createRequest = ( headers: { "Content-Type": "application/json", ...(token && { Authorization: `Bearer ${token}` }), - "X-Hotel-ID": hotelId, + "X-Hotel-ID": hardCodedHotelId, ...config.headers, }, body: config.data ? JSON.stringify(config.data) : undefined, @@ -74,9 +74,9 @@ export const useAPIClient = (): HttpClient => { // can be called during app startup (e.g. in a useEffect) // before any API calls are executed. const request = async (config: RequestConfig): Promise => { - const { getToken, hotelId } = getConfig(); + const { getToken } = getConfig(); const baseUrl = getBaseUrl(); - const doRequest = createRequest(getToken, baseUrl, hotelId); + const doRequest = createRequest(getToken, baseUrl); return doRequest(config); }; diff --git a/clients/shared/src/api/config.ts b/clients/shared/src/api/config.ts index 12cb60820..fee2aae85 100644 --- a/clients/shared/src/api/config.ts +++ b/clients/shared/src/api/config.ts @@ -8,7 +8,6 @@ export type Config = { API_BASE_URL: string getToken: () => Promise - hotelId: string } let config: Config | null = null diff --git a/clients/shared/src/api/orval-mutator.ts b/clients/shared/src/api/orval-mutator.ts index ad0d90a55..927ca8e5e 100755 --- a/clients/shared/src/api/orval-mutator.ts +++ b/clients/shared/src/api/orval-mutator.ts @@ -10,8 +10,8 @@ import { RequestConfig } from "../types/api.types"; export const useCustomInstance = (): (( config: RequestConfig, ) => Promise) => { - const { getToken, hotelId } = getConfig(); - const request = createRequest(getToken, getBaseUrl(), hotelId); + const { getToken } = getConfig(); + const request = createRequest(getToken, getBaseUrl()); return async (config: RequestConfig): Promise => { const response = await request(config); diff --git a/clients/web/src/routeTree.gen.ts b/clients/web/src/routeTree.gen.ts index d03f3cd37..385331118 100644 --- a/clients/web/src/routeTree.gen.ts +++ b/clients/web/src/routeTree.gen.ts @@ -11,7 +11,6 @@ import { Route as rootRouteImport } from './routes/__root' import { Route as SignUpRouteImport } from './routes/sign-up' import { Route as SignInRouteImport } from './routes/sign-in' -import { Route as NoOrgRouteImport } from './routes/no-org' import { Route as ProtectedRouteImport } from './routes/_protected' import { Route as IndexRouteImport } from './routes/index' import { Route as ProtectedTestApiRouteImport } from './routes/_protected/test-api' @@ -33,11 +32,6 @@ const SignInRoute = SignInRouteImport.update({ path: '/sign-in', getParentRoute: () => rootRouteImport, } as any) -const NoOrgRoute = NoOrgRouteImport.update({ - id: '/no-org', - path: '/no-org', - getParentRoute: () => rootRouteImport, -} as any) const ProtectedRoute = ProtectedRouteImport.update({ id: '/_protected', getParentRoute: () => rootRouteImport, @@ -90,7 +84,6 @@ const ProtectedGuestsGuestIdRoute = ProtectedGuestsGuestIdRouteImport.update({ export interface FileRoutesByFullPath { '/': typeof IndexRoute - '/no-org': typeof NoOrgRoute '/sign-in': typeof SignInRoute '/sign-up': typeof SignUpRoute '/home': typeof ProtectedHomeRoute @@ -104,7 +97,6 @@ export interface FileRoutesByFullPath { } export interface FileRoutesByTo { '/': typeof IndexRoute - '/no-org': typeof NoOrgRoute '/sign-in': typeof SignInRoute '/sign-up': typeof SignUpRoute '/home': typeof ProtectedHomeRoute @@ -119,7 +111,6 @@ export interface FileRoutesById { __root__: typeof rootRouteImport '/': typeof IndexRoute '/_protected': typeof ProtectedRouteWithChildren - '/no-org': typeof NoOrgRoute '/sign-in': typeof SignInRoute '/sign-up': typeof SignUpRoute '/_protected/home': typeof ProtectedHomeRoute @@ -135,7 +126,6 @@ export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath fullPaths: | '/' - | '/no-org' | '/sign-in' | '/sign-up' | '/home' @@ -149,7 +139,6 @@ export interface FileRouteTypes { fileRoutesByTo: FileRoutesByTo to: | '/' - | '/no-org' | '/sign-in' | '/sign-up' | '/home' @@ -163,7 +152,6 @@ export interface FileRouteTypes { | '__root__' | '/' | '/_protected' - | '/no-org' | '/sign-in' | '/sign-up' | '/_protected/home' @@ -179,7 +167,6 @@ export interface FileRouteTypes { export interface RootRouteChildren { IndexRoute: typeof IndexRoute ProtectedRoute: typeof ProtectedRouteWithChildren - NoOrgRoute: typeof NoOrgRoute SignInRoute: typeof SignInRoute SignUpRoute: typeof SignUpRoute } @@ -200,13 +187,6 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof SignInRouteImport parentRoute: typeof rootRouteImport } - '/no-org': { - id: '/no-org' - path: '/no-org' - fullPath: '/no-org' - preLoaderRoute: typeof NoOrgRouteImport - parentRoute: typeof rootRouteImport - } '/_protected': { id: '/_protected' path: '' @@ -319,7 +299,6 @@ const ProtectedRouteWithChildren = ProtectedRoute._addFileChildren( const rootRouteChildren: RootRouteChildren = { IndexRoute: IndexRoute, ProtectedRoute: ProtectedRouteWithChildren, - NoOrgRoute: NoOrgRoute, SignInRoute: SignInRoute, SignUpRoute: SignUpRoute, } diff --git a/clients/web/src/routes/__root.tsx b/clients/web/src/routes/__root.tsx index 541323965..db64dc9a1 100644 --- a/clients/web/src/routes/__root.tsx +++ b/clients/web/src/routes/__root.tsx @@ -1,12 +1,7 @@ -import { - HeadContent, - Scripts, - createRootRoute, - useNavigate, -} from "@tanstack/react-router"; +import { HeadContent, Scripts, createRootRoute } from "@tanstack/react-router"; import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools"; import { TanStackDevtools } from "@tanstack/react-devtools"; -import { ClerkProvider, useAuth, useOrganization } from "@clerk/clerk-react"; +import { ClerkProvider, useAuth } from "@clerk/clerk-react"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; import { setConfig } from "@shared"; @@ -65,21 +60,8 @@ export const Route = createRootRoute({ // Component to configure auth provider and the api base url function AppConfigurator() { const { getToken } = useAuth(); - const { organization } = useOrganization(); - const hotelId = organization?.publicMetadata.hotel_id; - - const navigate = useNavigate(); - - if (!hotelId) { - navigate({ to: "/no-org" }); - } - useEffect(() => { - setConfig({ - API_BASE_URL: process.env.API_BASE_URL ?? "", - getToken, - hotelId: hotelId as string, - }); + setConfig({ API_BASE_URL: process.env.API_BASE_URL ?? "", getToken }); }, [getToken]); return null; diff --git a/clients/web/src/routes/no-org.tsx b/clients/web/src/routes/no-org.tsx deleted file mode 100644 index 6b91bdc58..000000000 --- a/clients/web/src/routes/no-org.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from "@tanstack/react-router"; - -export const Route = createFileRoute("/no-org")({ - component: NoOrgPage, -}); - -function NoOrgPage() { - return ( -
-

No Organization Found

-

- You're not part of a hotel organization yet. Please contact your manager - for an invitation. -

-
- ); -}