feat: add new account management
This commit is contained in:
@@ -1,18 +1,9 @@
|
||||
import { PropsWithChildren, useEffect, useState } from "react";
|
||||
import { PropsWithChildren, createContext, useMemo } from "react";
|
||||
import { Ark } from "./ark";
|
||||
import { LumeContext } from "./context";
|
||||
|
||||
export const LumeProvider = ({ children }: PropsWithChildren<object>) => {
|
||||
const [ark, setArk] = useState<Ark>(undefined);
|
||||
export const ArkContext = createContext<Ark>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
async function setupArk() {
|
||||
const _ark = new Ark();
|
||||
setArk(_ark);
|
||||
}
|
||||
|
||||
if (!ark) setupArk();
|
||||
}, []);
|
||||
|
||||
return <LumeContext.Provider value={ark}>{children}</LumeContext.Provider>;
|
||||
export const ArkProvider = ({ children }: PropsWithChildren<object>) => {
|
||||
const ark = useMemo(() => new Ark(), []);
|
||||
return <ArkContext.Provider value={ark}>{children}</ArkContext.Provider>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user