diff --git a/web/src/pages/Index/index.tsx b/web/src/pages/Index/index.tsx index 00e25ff..2907398 100644 --- a/web/src/pages/Index/index.tsx +++ b/web/src/pages/Index/index.tsx @@ -1,30 +1,14 @@ -import { deriveDeviceKey, getDeviceId } from "@/util/deviceId"; -import { useEffect, useState, type FC } from "react"; +import { useAccountRepo } from "@/repository/account"; +import { useEffect, type FC } from "react"; const IndexPage: FC = () => { - const [deviceId, setDeviceId] = useState(""); - const [deviceKey, setDeviceKey] = useState(""); + const repo = useAccountRepo(); useEffect(() => { - getDeviceId().then((id) => { - setDeviceId(id); - deriveDeviceKey(id).then((key) => { - crypto.subtle.exportKey("raw", key).then((key) => { - const enc = new TextDecoder(); - setDeviceKey(enc.decode(key)); - }); - }); - }); - }, []); + repo.loadAll().then((res) => console.log({ res })); + }, [repo]); - return ( -
-

Id:

-

{deviceId}

-

Key:

-

{deviceKey}

-
- ); + return
; }; export default IndexPage;