Feature/32 deploy api as azure function app (#34)
* changing api to azure function app * changing api to azure function app * changing api to azure function app * changing api to azure function app * changing api to azure function app * changing api to azure function app * changing api to azure container app
This commit was merged in pull request #34.
This commit is contained in:
@@ -12,36 +12,36 @@ const App: React.FC<unknown> = () => {
|
||||
const httpClient: AxiosInstance = useHttpClient();
|
||||
const appContext = useAppContext();
|
||||
|
||||
useEffect(() => {
|
||||
const getFeatureFlags = async () => {
|
||||
try {
|
||||
const featureFlagKeys: string = 'flying-pilots';
|
||||
const response: AxiosResponse = await httpClient.get(
|
||||
`api/featureFlags?keys=${featureFlagKeys}&label=${import.meta.env.MODE}`
|
||||
);
|
||||
const featureFlags: { key: string; enabled: boolean }[] = response.data;
|
||||
// useEffect(() => {
|
||||
// const getFeatureFlags = async () => {
|
||||
// try {
|
||||
// const featureFlagKeys: string = 'flying-pilots';
|
||||
// const response: AxiosResponse = await httpClient.get(
|
||||
// `api/featureFlags?keys=${featureFlagKeys}&label=${import.meta.env.MODE}`
|
||||
// );
|
||||
// const featureFlags: { key: string; enabled: boolean }[] = response.data;
|
||||
|
||||
if (featureFlags.length > 0) {
|
||||
appContext.dispatch({
|
||||
type: 'SET_FEATURE_FLAGS',
|
||||
payload: featureFlags
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
// if (featureFlags.length > 0) {
|
||||
// appContext.dispatch({
|
||||
// type: 'SET_FEATURE_FLAGS',
|
||||
// payload: featureFlags
|
||||
// });
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.log(error);
|
||||
// }
|
||||
// };
|
||||
|
||||
getFeatureFlags();
|
||||
}, []);
|
||||
// getFeatureFlags();
|
||||
// }, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<SiteNav />
|
||||
<Routes>
|
||||
{useFeatureFlag('flying-pilots')?.enabled && (
|
||||
<Route path="/pilots" element={<Pilots />} />
|
||||
)}
|
||||
{/* {useFeatureFlag('flying-pilots')?.enabled && ( */}
|
||||
<Route path="/pilots" element={<Pilots />} />
|
||||
{/* )} */}
|
||||
<Route path="/" element={<Logbook />} />
|
||||
</Routes>
|
||||
</div>
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
import axios, { AxiosInstance, CreateAxiosDefaults } from 'axios';
|
||||
|
||||
export const useHttpClient = () => {
|
||||
let config: CreateAxiosDefaults<any>;
|
||||
let config: CreateAxiosDefaults<any> = {
|
||||
baseURL: import.meta.env.VITE_API_URL,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
};
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
config = {
|
||||
baseURL: import.meta.env.VITE_API_URL,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
};
|
||||
} else {
|
||||
config = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
};
|
||||
}
|
||||
// if (import.meta.env.DEV) {
|
||||
// config = {
|
||||
// baseURL: import.meta.env.VITE_API_URL,
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// };
|
||||
// } else {
|
||||
// config = {
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json'
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
|
||||
const httpClient: AxiosInstance = axios.create(config);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user