wip: migrate to desktop2

This commit is contained in:
reya
2024-02-12 09:08:35 +07:00
parent c809ab6b4e
commit 1950cb59a2
25 changed files with 347 additions and 51 deletions
+12 -1
View File
@@ -1,10 +1,21 @@
import { PropsWithChildren, createContext, useContext, useMemo } from "react";
import {
PropsWithChildren,
createContext,
useContext,
useEffect,
useMemo,
} from "react";
import { Ark } from "./ark";
export const ArkContext = createContext<Ark>(undefined);
export const ArkProvider = ({ children }: PropsWithChildren<object>) => {
const ark = useMemo(() => new Ark(), []);
useEffect(() => {
if (ark) ark.load_account();
}, []);
return <ArkContext.Provider value={ark}>{children}</ArkContext.Provider>;
};