mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-29 09:18:59 +02:00
Add disable home page option
This commit is contained in:
@@ -10,7 +10,7 @@ const isSignedIn = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
export const IsSignedInContext = createContext(false);
|
||||
export const IsSignedInContext = createContext(true);
|
||||
|
||||
export default {
|
||||
isSignedIn,
|
||||
|
||||
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user