31 lines
702 B
TypeScript
31 lines
702 B
TypeScript
import { Suspense } from "react";
|
|
import { frame, ohg, option } from "../constant";
|
|
import Unity from "./unity";
|
|
|
|
const getItem = async () => {
|
|
return await Promise.resolve({ option, ohg, frame });
|
|
};
|
|
|
|
const getInitMatch = async () => {
|
|
return await fetch(`${process.env.DOMAIN}/fit?o=0&f=0`, {
|
|
method: "GET",
|
|
});
|
|
};
|
|
|
|
export default async function UnityComponent() {
|
|
const { option, ohg, frame } = await getItem();
|
|
const res = await getInitMatch();
|
|
const initMatch = (await res.json()) as { match: number };
|
|
|
|
return (
|
|
<Suspense>
|
|
<Unity
|
|
option={option}
|
|
ohg={ohg}
|
|
frame={frame}
|
|
initMatch={initMatch?.match ?? 0}
|
|
/>
|
|
</Suspense>
|
|
);
|
|
}
|