Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
fix: Fetch header props from firestore
Browse files Browse the repository at this point in the history
  • Loading branch information
Sansai-snct committed Dec 16, 2022
1 parent d44d687 commit c7495be
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/layout/edit.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { FC, ReactNode, ReactElement, useEffect, useState } from "react";
import { useRouter } from "next/router";
import { Box, Flex } from "@chakra-ui/react";
import type { ListInfo } from "libs/firebase/types";
import { onAuthStateChanged } from "firebase/auth";
import { getInfo } from "libs/firebase/store";
import { auth } from "../../libs/firebase/init";
import { EditHeader } from "./header/edit";

Expand All @@ -10,7 +12,7 @@ interface EditLayoutInterface {
}

const EditLayout: FC<EditLayoutInterface> = ({ children }) => {
const [listid, setListid] = useState("");
const [listid, setListid] = useState("0");
const [link, setLink] = useState("");
const [name, setName] = useState("");

Expand All @@ -22,6 +24,8 @@ const EditLayout: FC<EditLayoutInterface> = ({ children }) => {
const i = id as string;
setListid(i);
setLink(`https://alibum.re-taro.dev/view?from=${u.uid}&to=${listid}`);
const res: ListInfo = await getInfo(u.uid, listid);
if (typeof res !== "undefined") setName(res.name);
}
});
return () => {
Expand Down

0 comments on commit c7495be

Please sign in to comment.