refactor: moving from nextjs to vite+react

This commit is contained in:
2024-01-28 12:14:04 +01:00
parent 9bb6ccdd4f
commit 8446ee6c65
52 changed files with 610 additions and 2337 deletions

View File

@@ -1,39 +0,0 @@
import {
createContext,
useEffect,
useContext,
useState,
ReactNode,
} from "react";
import axios from "axios";
import { Manifest } from "~/utils/types";
const AppContext = createContext<Manifest | undefined>(undefined);
export const AppContextProvider = (props: {
children: Array<ReactNode> | ReactNode;
}) => {
const [manifest, setManifest] = useState<Manifest>();
useEffect(() => {
axios
.get<Manifest>(
"https://raw.githubusercontent.com/pihkaal/pihkaal/main/manifest.json",
)
.then(x => {
setManifest(x.data);
console.log(x.data);
});
}, []);
return (
<AppContext.Provider value={manifest}>{props.children}</AppContext.Provider>
);
};
export const useApp = () => {
const context = useContext(AppContext);
if (!context) throw new Error("useApp must be used inside the app lol");
return context;
};