Skip to content

Commit

Permalink
refactor: 프로토콜이 붙지 않은 url에 대해서 프로토콜을 붙여주는 로직
Browse files Browse the repository at this point in the history
삭제
  • Loading branch information
smb0123 committed Sep 24, 2024
1 parent 6b1beed commit b4a5f68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
7 changes: 3 additions & 4 deletions frontend/components/applicant/applicantNode/Portfolio.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Txt from "@/components/common/Txt.component";
import { ApplicantReq } from "@/src/apis/applicant";
import { applicantDataFinder } from "@/src/functions/finder";
import { changeIntactUrl } from "@/src/utils/applicant";
import Link from "next/link";

interface PortfolioProps {
Expand All @@ -13,15 +12,15 @@ const Portfolio = ({ data }: PortfolioProps) => {

const portfolio = applicantDataFinder(data, "portfolio")
.split(regex)
.map((url: string) => changeIntactUrl(url.trim()));
.map((url: string) => url.trim());

const file = applicantDataFinder(data, "fileUrl")
.split(regex)
.map((url: string) => changeIntactUrl(url.trim()));
.map((url: string) => url.trim());

const fileUrlForPlanner = applicantDataFinder(data, "fileUrlforPlanner")
.split(regex)
.map((url: string) => changeIntactUrl(url.trim()));
.map((url: string) => url.trim());

return (
<>
Expand Down
10 changes: 0 additions & 10 deletions frontend/src/utils/applicant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,3 @@ export const findApplicantState = (
return cardsData.find((card) => card.applicantId === applicantId)?.state
.passState;
};

export const changeIntactUrl = (url: string) => {
if (!url) return url;

if (!/^https?:\/\//.test(url)) {
return `http://${url}`;
}

return url;
};

0 comments on commit b4a5f68

Please sign in to comment.