Skip to content

Commit

Permalink
fix: fix channel error
Browse files Browse the repository at this point in the history
  • Loading branch information
loopy-lim committed Sep 2, 2023
1 parent 32a2a4c commit 02d6b0e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions frontend/components/applicant/Board.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ const ApplicantBoard: FC<ApplicantBoardProps> = ({ generation }) => {

return (
<Board wapperClassname="divide-x" boardData={boardData} onClick={onClick}>
<div className="flex flex-1 min-h-0">
<div className="flex-1 overflow-auto px-12">
<div className="flex flex-1">
<div className="flex-1 overflow-auto px-12 min-w-[40rem]">
<ApplicantDetailLeft data={data} />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ const ApplicantTextarea: FC<ApplicantTextareaProps> = ({ nodeData, data }) => {
const textareaData = nodeData as ApplicantTextareaNode;

return (
<>
<Txt className="block pt-6 pb-12 ml-6">
{applicantDataFinder(data, textareaData.value.name)}
</Txt>
</>
<Txt className="block pt-6 pb-12 ml-6">
{applicantDataFinder(data, textareaData.value.name)}
</Txt>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const TextArea: FC<TextAreaProps> = ({ index, node }) => {
<textarea
className="my-2 border rounded-lg p-4 w-full resize-none"
rows={20}
maxLength={1000}
name={node.name}
value={textValue}
onChange={(e) => setTextValue(e.target.value)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ApplicationCheckboxWithEtc: FC<ApplicationCheckboxWithEtcProps> = ({
}) => {
const checkboxWithEtcData = data as ApplicationCheckboxWithEtcType;
const [isOpenEtc, setIsOpenEtc] = useState(
localStorage.get(checkboxWithEtcData.name + "Etc") !== ""
localStorage.get(checkboxWithEtcData.name + "Etc", "") !== ""
);
const [etcValue, setEtcValue] = useLocalStorage<string>(
checkboxWithEtcData.name + "Etc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ const ApplicationTexarea: FC<ApplicationTexareaProps> = ({ data }) => {
rows={20}
name={textData.name}
value={value}
maxLength={1000}
onChange={(e) => {
if (e.target.value.length > 1000)
return alert("1000자 이내로 작성해주세요.");
setValue(e.target.value.slice(1000));
setValue(e.target.value);
}}
/>
</>
Expand Down
9 changes: 7 additions & 2 deletions frontend/components/application/sendApplication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const extractApplicantData = (
});
return;
}
if (key === "name" && value !== "timeline") {
if (key === "name" && value !== "timeline" && value !== "channel") {
if ("require" in node) {
if (localStorage.get(value, "").length === 0 && node.require) {
throw new Error(`지원서 작성이 완료되지 않았습니다. ${value}`);
Expand All @@ -50,6 +50,7 @@ export const postApplication = async (

try {
extractApplicantData(applicationQuestions, applicationData);

applicationData.add({
name: "generation",
answer: `${CURRENT_GENERATION}`,
Expand All @@ -63,10 +64,14 @@ export const postApplication = async (
name: "channel",
answer: channel.push(localStorage.get("channelEtc", "")),
});
if (localStorage.get("channel", "").length === 0) {
throw new Error("지원 경로를 선택해주세요.");
}

const applicantId = await postApplicant(Array.from(applicationData));
const timeline = localStorage.get<number[]>("timeline", []);
if (!Array.isArray(timeline) || timeline.length === 0) {
new Error("시간표가 존재하지 않습니다.");
throw new Error("시간표가 존재하지 않습니다.");
}
await postApplicantTimeline(applicantId, timeline);
} catch (e) {
Expand Down
9 changes: 7 additions & 2 deletions frontend/src/functions/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ const isCellPhoneNumber = (phoneNumber: string) =>
const isUndergradeNumber = (isUndergradeNumber: string) =>
/^[0-9]{6}$/.test(isUndergradeNumber);

const isEmailString = (emailString: string) =>
/^[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[A-Za-z]+$/.test(emailString);
const isEmailString = (emailString: string) => {
const re =
// eslint-disable-next-line no-useless-escape
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

return re.test(emailString);
};

const isConfirmationString = (confirmationString: string) =>
/확인했습니다/.test(confirmationString);
Expand Down

0 comments on commit 02d6b0e

Please sign in to comment.