2024-02-03 20:30:00 -07:00
|
|
|
import { DEV_USER_ID } from "@env";
|
2024-01-06 18:51:59 -07:00
|
|
|
import React from "react";
|
2024-02-03 18:23:46 -07:00
|
|
|
import { ClientProvider, useAuthHeader } from "./graphql/client";
|
2024-02-03 20:30:00 -07:00
|
|
|
import AppNavigator from "./navigation/app-navigator";
|
2024-02-03 18:23:46 -07:00
|
|
|
|
|
|
|
const SetAuthHeaderBasedOnEnv = () => {
|
|
|
|
const { setAuthHeader } = useAuthHeader();
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
if (DEV_USER_ID) {
|
|
|
|
setAuthHeader({ key: "user_id", value: DEV_USER_ID });
|
|
|
|
}
|
|
|
|
}, [setAuthHeader]);
|
|
|
|
|
|
|
|
return null;
|
|
|
|
};
|
2024-01-06 18:51:59 -07:00
|
|
|
|
|
|
|
const App: React.FC = () => {
|
2024-01-06 19:25:17 -07:00
|
|
|
return (
|
2024-01-31 16:55:33 -07:00
|
|
|
<ClientProvider>
|
2024-02-03 18:23:46 -07:00
|
|
|
<SetAuthHeaderBasedOnEnv />
|
2024-01-31 16:55:33 -07:00
|
|
|
<AppNavigator />
|
|
|
|
</ClientProvider>
|
2024-01-06 19:25:17 -07:00
|
|
|
);
|
2024-01-06 18:51:59 -07:00
|
|
|
};
|
|
|
|
|
2024-01-06 23:58:54 -07:00
|
|
|
export default function Root() {
|
|
|
|
return (
|
|
|
|
<React.StrictMode>
|
|
|
|
<App />
|
|
|
|
</React.StrictMode>
|
|
|
|
);
|
|
|
|
}
|