Add disable home page option

This commit is contained in:
Elias Schneider
2022-05-02 22:42:27 +02:00
parent 2cdd802422
commit c02e9c4efb
10 changed files with 46 additions and 43 deletions

View File

@@ -10,7 +10,7 @@ const isSignedIn = async () => {
}
};
export const IsSignedInContext = createContext(false);
export const IsSignedInContext = createContext(true);
export default {
isSignedIn,

View File

@@ -1,12 +1,24 @@
import axios from "axios";
import { createContext, useContext } from "react";
export const ConfigContext = createContext<any>({});
export const useConfig = () => useContext(ConfigContext);
const getGonfig = async() => {
return (await axios.get("/api/config")).data;
const getGonfig = () => {
let publicEnvironmentVariables: any = {};
Object.entries(process.env).forEach(([key, value]: any) => {
value as string | number | boolean;
if (key.startsWith("PUBLIC") && value) {
key = key.replace("PUBLIC_", "");
if (value == "false" || value == "true") {
value = JSON.parse(value);
} else if (!isNaN(Number(value))) {
value = parseInt(value as string);
}
publicEnvironmentVariables[key] = value;
}
});
return publicEnvironmentVariables;
};
export default { getGonfig };