Skip to content

Commit 9c42d78

Browse files
committed
feat: implement login processing state management using useRef
1 parent aea8c9e commit 9c42d78

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • apps/ticket/src/app/(pages)/auth

apps/ticket/src/app/(pages)/auth/page.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { useCallback, useEffect } from "react";
3+
import { useCallback, useEffect, useRef } from "react";
44
import { useRouter, useSearchParams } from "next/navigation";
55

66
import { useLoginMutation } from "@/data/users/postUserLogin/mutation";
@@ -36,7 +36,13 @@ const AuthPage = () => {
3636

3737
const { mutateAsync } = useLoginMutation();
3838

39+
const isLoginProcessingRef = useRef(false);
40+
3941
const handleLogin = useCallback(async () => {
42+
if (isLoginProcessingRef.current) return;
43+
44+
isLoginProcessingRef.current = true;
45+
4046
if (authorizationCode) {
4147
try {
4248
await mutateAsync({

0 commit comments

Comments
 (0)