railbird-gql/App.tsx

34 lines
660 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) {
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>
);
}