From 1c7724701b2c82ae6762bdcfd07a5a08d85789b0 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Tue, 3 Sep 2024 00:17:24 +0900 Subject: 変数名のgithubの綴りに違和感があったので修正 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SignUpForm3.tsx | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/SignUpForm3.tsx') diff --git a/src/SignUpForm3.tsx b/src/SignUpForm3.tsx index e3b347d..bfe2f45 100644 --- a/src/SignUpForm3.tsx +++ b/src/SignUpForm3.tsx @@ -26,18 +26,18 @@ export const SignUpForm3Main = () => { const location = useLocation(); const formData = location.state as { form1: Form1Data, form2: Form2Data } | null; const navigate = useNavigate(); - const watchHasGitHubRepo = watch("hasGitHubRepo", false) - const gitHubUsername = watch("gitHubUsername", '') + const watchHasGithubRepo = watch("hasGithubRepo", false) + const githubUsername = watch("githubUsername", '') - const repoQueryEnabled = watchHasGitHubRepo && gitHubUsername.length > 0; + const repoQueryEnabled = watchHasGithubRepo && githubUsername.length > 0; - console.log(gitHubUsername) + console.log(githubUsername) console.log(repoQueryEnabled) const { data: reposData, isLoading: reposIsLoading, isError: reposIsError, error: reposError } = useQuery({ - queryKey: ['gitHubRepos', gitHubUsername], + queryKey: ['githubRepos', githubUsername], queryFn: async () => { - const res = await fetch(`https://api.github.com/users/${gitHubUsername}/repos?sort=updated&direction=desc&per_page=100`) + const res = await fetch(`https://api.github.com/users/${githubUsername}/repos?sort=updated&direction=desc&per_page=100`) if (res.ok) { return res.json(); } throw new Error(res.statusText) }, @@ -49,9 +49,9 @@ export const SignUpForm3Main = () => { [] useEffect(() => { - setValue('gitHubUsername', '') + setValue('githubUsername', '') setValue('repoName', '') - }, [watchHasGitHubRepo]) + }, [watchHasGithubRepo]) // form1, form2 のデータがない場合は form1 にリダイレクトする if (formData === null) { @@ -71,15 +71,15 @@ export const SignUpForm3Main = () => {

会員登録 フェーズ 3

- - -
{errors.hasGitHubRepo?.message}
+ + +
{errors.hasGithubRepo?.message}
{ - (watchHasGitHubRepo && + (watchHasGithubRepo &&
- - + +
) } -- cgit v1.2.3