diff --git a/app/src/app/camera/page.tsx b/app/src/app/camera/page.tsx index 37ff42e..df48474 100644 --- a/app/src/app/camera/page.tsx +++ b/app/src/app/camera/page.tsx @@ -88,7 +88,7 @@ const CameraApp = () => { todayAssignment | undefined >(); const [assignments, setAssignments] = useState([]); - const [isActive, setIsActive] = useState(true); + const [isActive, setIsActive] = useState(false); const [isPointDialogOpen, _] = usePointDialog(); const openDialog = useOpenPointDialog(); const [loginUser, setLoginUser] = useState(); diff --git a/app/src/lib/signInAndUp.ts b/app/src/lib/signInAndUp.ts index 6d60edb..765ebaf 100644 --- a/app/src/lib/signInAndUp.ts +++ b/app/src/lib/signInAndUp.ts @@ -16,7 +16,6 @@ export const signInOrUp = async (firebaseUser: FirebaseUser) => { if (res.status === 200) { const userData = await res.json(); - const user: DBUser = { ...userData }; if (userData) { @@ -28,6 +27,8 @@ export const signInOrUp = async (firebaseUser: FirebaseUser) => { } } else if (res.status === 404) { await signUp(firebaseUser); + // サインアップ後にユーザー情報を取得してログイン処理を行う + await signInOrUp(firebaseUser); } else { console.error(`Unexpected status code: ${res.status}`); } @@ -46,14 +47,11 @@ const signUp = async (user: User) => { body: JSON.stringify(user), }); - const resUser = await res.json(); - - if (resUser) { - storeStorageUser(resUser); - toRoot(); - } else { - throw new Error("ユーザー登録に失敗"); + if (res.status === 200) { + // ユーザー登録が成功した場合は何もせず戻る + return; } + throw new Error("ユーザー登録に失敗"); } catch (error) { console.error("エラーが発生しました:", error); } @@ -81,4 +79,4 @@ const createExp = async (userId: number) => { const toRoot = () => { window.location.href = "/"; -}; +}; \ No newline at end of file