Feature/33 api fails when no pilots or logbook entries #35
@@ -12,36 +12,36 @@ const App: React.FC<unknown> = () => {
|
|||||||
const httpClient: AxiosInstance = useHttpClient();
|
const httpClient: AxiosInstance = useHttpClient();
|
||||||
const appContext = useAppContext();
|
const appContext = useAppContext();
|
||||||
|
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// const getFeatureFlags = async () => {
|
const getFeatureFlags = async () => {
|
||||||
// try {
|
try {
|
||||||
// const featureFlagKeys: string = 'flying-pilots';
|
const featureFlagKeys: string = 'flying-pilots';
|
||||||
// const response: AxiosResponse = await httpClient.get(
|
const response: AxiosResponse = await httpClient.get(
|
||||||
// `api/featureFlags?keys=${featureFlagKeys}&label=${import.meta.env.MODE}`
|
`api/featureFlags?keys=${featureFlagKeys}&label=${import.meta.env.MODE}`
|
||||||
// );
|
);
|
||||||
// const featureFlags: { key: string; enabled: boolean }[] = response.data;
|
const featureFlags: { key: string; enabled: boolean }[] = response.data;
|
||||||
|
|
||||||
// if (featureFlags.length > 0) {
|
if (featureFlags.length > 0) {
|
||||||
// appContext.dispatch({
|
appContext.dispatch({
|
||||||
// type: 'SET_FEATURE_FLAGS',
|
type: 'SET_FEATURE_FLAGS',
|
||||||
// payload: featureFlags
|
payload: featureFlags
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// } catch (error) {
|
} catch (error) {
|
||||||
// console.log(error);
|
console.log(error);
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
|
|
||||||
// getFeatureFlags();
|
getFeatureFlags();
|
||||||
// }, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<SiteNav />
|
<SiteNav />
|
||||||
<Routes>
|
<Routes>
|
||||||
{/* {useFeatureFlag('flying-pilots')?.enabled && ( */}
|
{useFeatureFlag('flying-pilots')?.enabled && (
|
||||||
<Route path="/pilots" element={<Pilots />} />
|
<Route path="/pilots" element={<Pilots />} />
|
||||||
{/* )} */}
|
)}
|
||||||
<Route path="/" element={<Logbook />} />
|
<Route path="/" element={<Logbook />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user