Skip to content

Commit

Permalink
Merge pull request #54 from yu-senier-project/feat/profile-company
Browse files Browse the repository at this point in the history
회사 없음까지 추가
  • Loading branch information
yeongipark authored Jun 6, 2024
2 parents be0dc3b + 3195d26 commit a2a4107
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
34 changes: 31 additions & 3 deletions src/component/profile/CompanyAndJob/ProfileCompanySearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const ProfileCompanySearch = ({
nowCompany,
}) => {
// 타이머 훅 사용
const { minutes, seconds, isActive, toggle } = useTimer(3, 0);
const { minutes, seconds, isActive, toggle } = useTimer(5, 0);

const inputRef = useRef(null);
const [search, setSearch] = useState("");
Expand All @@ -32,6 +32,9 @@ export const ProfileCompanySearch = ({
// 회사 이메일 저장
const [email, setEmail] = useState("");

// 회사 없을 일때 이메일 주소 입력 받음
const [emailArr, setEmailArr] = useState("");

// 사용자 입력 이메일 저장
const [inputEmail, setInputEmail] = useState("");

Expand All @@ -50,6 +53,17 @@ export const ProfileCompanySearch = ({
alert("올바른 이메일을 입력하세요");
return;
}

if (selectValue == "없음" && emailArr.length < 5) {
alert("올바른 이메일을 입력하세요");
}
if (selectValue == "없음") {
toggle();
setOnAuth(true);
const data = await getEmail(`${inputEmail}@${emailArr}`);
return;
}

toggle();
setOnAuth(true);
const data = await getEmail(`${inputEmail}@${email}`);
Expand Down Expand Up @@ -115,6 +129,7 @@ export const ProfileCompanySearch = ({
alert("회사를 선택하세요.");
return;
}

setStage(2);

const data = await getCompanyEmail(selectValue);
Expand Down Expand Up @@ -182,7 +197,7 @@ export const ProfileCompanySearch = ({
</>
) : (
<div className="ProfileAuth">
<h4>회사 인증</h4>
{selectValue == "없음" ? <h4>본인 인증</h4> : <h4>회사 인증</h4>}
<div className="ProfileAuth-email">
<input
onKeyDown={onKeyDown}
Expand All @@ -193,7 +208,20 @@ export const ProfileCompanySearch = ({
type="text"
disabled={isActive || finish}
/>
<span>{`@${email}`}</span>
{selectValue == "없음" ? (
<>
<span>@</span>
<input
type="text"
value={emailArr}
onChange={(e) => {
setEmailArr(e.target.value);
}}
/>
</>
) : (
<span>{`@${email}`}</span>
)}
<button
className="ProfileAuth-btn"
disabled={isActive || finish}
Expand Down
5 changes: 3 additions & 2 deletions src/react-query/useProject.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,9 @@ export const useGetAllTodos = (projectId) => {
queryFn: () => getAllTodos(projectId),
staleTime: 5 * 1000 * 60,
gcTime: 10 * 1000 * 60,
// refetchOnWindowFocus: false,
// refetchOnReconnect: false,
refetchOnMount: true,
refetchOnWindowFocus: true,
refetchOnReconnect: true,
});
return { data, isLoading };
};

0 comments on commit a2a4107

Please sign in to comment.