35 lines
729 B
TypeScript
35 lines
729 B
TypeScript
import { DEV_USER_ID } from "@env";
|
|
import React from "react";
|
|
import { ClientProvider, useAuthHeader } from "./graphql/client";
|
|
import AppNavigator from "./navigation/app-navigator";
|
|
|
|
const SetAuthHeaderBasedOnEnv = () => {
|
|
const { setAuthHeader } = useAuthHeader();
|
|
|
|
React.useEffect(() => {
|
|
if (DEV_USER_ID) {
|
|
console.log("Setting fake authorization user to: ", DEV_USER_ID);
|
|
setAuthHeader({ key: "user_id", value: DEV_USER_ID });
|
|
}
|
|
}, [setAuthHeader]);
|
|
|
|
return null;
|
|
};
|
|
|
|
const App: React.FC = () => {
|
|
return (
|
|
<ClientProvider>
|
|
<SetAuthHeaderBasedOnEnv />
|
|
<AppNavigator />
|
|
</ClientProvider>
|
|
);
|
|
};
|
|
|
|
export default function Root() {
|
|
return (
|
|
<React.StrictMode>
|
|
<App />
|
|
</React.StrictMode>
|
|
);
|
|
}
|