-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feat/#88, #95, #96 ๊ตฌ์ธ๊ธ ๋ง๊ฐ API ์ฐ๋, ๋ฒ์ญ ๋ฐ์ดํฐ ์์ฑ ๋ฐ ์ฝ๋ ๋ฆฌ๋ทฐ ๋ฆฌํฉํ ๋ง
- Loading branch information
Showing
61 changed files
with
1,002 additions
and
2,017 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { APIPath } from '@/apis/apiPath'; | ||
import { foreigner } from '@/features/applicants/ApplicantList/ContractModal/ContractModal.mock'; | ||
import { foreigner } from './foreigner.mock'; | ||
import { http, HttpResponse } from 'msw'; | ||
|
||
export const foreignerMockHandler = [http.get(APIPath.getForeigner, () => HttpResponse.json(foreigner))]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { APIPath } from '@/apis/apiPath'; | ||
import { applicantList } from '@/pages/applicants/Applicants.mock'; | ||
import { applicantList } from './applicants.mock'; | ||
import { http, HttpResponse } from 'msw'; | ||
|
||
export const myApplicantsMockHandler = [http.get(APIPath.getMyApplicants, () => HttpResponse.json(applicantList))]; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { APIPath } from '@/apis/apiPath'; | ||
import { companyList } from '@/pages/myPage/employer/EmployerMyPage.mock'; | ||
import { companyList } from './myCompanies.mock'; | ||
import { http, HttpResponse } from 'msw'; | ||
|
||
export const myCompaniesMockHandler = [http.get(APIPath.getMyCompanies, () => HttpResponse.json(companyList))]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { getDynamicAPIPath } from '@/apis/apiPath'; | ||
import { clientInstance } from '@/apis/instance'; | ||
import { useMutation } from '@tanstack/react-query'; | ||
|
||
export const closeRecruitment = async (recruitmentId: number) => { | ||
const response = await clientInstance.post(getDynamicAPIPath.closeRecruitment(recruitmentId)); | ||
return response.data; | ||
}; | ||
|
||
export const useCloseRecruitment = () => | ||
useMutation({ | ||
mutationFn: closeRecruitment, | ||
}); |
14 changes: 14 additions & 0 deletions
14
src/apis/recruitments/mocks/closeRecruitmentMockHandler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { APIPath } from '@/apis/apiPath'; | ||
import { http, HttpResponse } from 'msw'; | ||
|
||
export const closeRecruitmentMockHandler = [ | ||
http.post(APIPath.closeRecruitment, async ({ params }) => { | ||
const { recruitmentId } = params; | ||
|
||
if (!recruitmentId) { | ||
return HttpResponse.json({ message: '์๋ชป๋ ์์ฒญ์ ๋๋ค.' }, { status: 400 }); | ||
} | ||
|
||
return HttpResponse.json({ message: '๋ง๊ฐ ์๋ฃ' }, { status: 200 }); | ||
}), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const Applicants = { | ||
APPLICANT_LIST: '์ง์์ ๋ชฉ๋ก', | ||
TOTAL_APPLICANTS: (count: number) => `์ด ${count}๋ช `, | ||
VIEW_DETAILS: '์์ธํ ๋ณด๋ฌ๊ฐ๊ธฐ', | ||
TABLE_HEADERS: { | ||
NAME: '์ด๋ฆ', | ||
NATION: '๊ตญ์ ', | ||
KOREAN_LANGUAGE_LEVEL: 'ํ๊ตญ์ด ์ค๋ ฅ', | ||
}, | ||
BUTTONS: { | ||
VIEW_RESUME: '์ง์์', | ||
CREATE_CONTRACT: '๊ณ์ฝํ๊ธฐ', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const Applicants = { | ||
APPLICANT_LIST: 'Danh sรกch แปฉng viรชn', | ||
TOTAL_APPLICANTS: (count: number) => `Tแปng cแปng ${count} ngฦฐแปi`, | ||
VIEW_DETAILS: 'Xem chi tiแบฟt', | ||
TABLE_HEADERS: { | ||
NAME: 'Tรชn', | ||
NATION: 'Quแปc tแปch', | ||
KOREAN_LANGUAGE_LEVEL: 'Trรฌnh ฤแป tiแบฟng Hร n', | ||
}, | ||
BUTTONS: { | ||
VIEW_RESUME: 'Hแป sฦก แปฉng tuyแปn', | ||
CREATE_CONTRACT: 'Kรฝ hแปฃp ฤแปng', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const EmployerMyPage = { | ||
GREETING: '์ฌ์ฅ๋, ์๋ ํ์ธ์!', | ||
REGISTER_SIGN: '์ฌ์ธ ๋ฑ๋ก', | ||
MY_COMPANIES: '๋ด ํ์ฌ', | ||
TOTAL_COMPANIES: (count: number) => `์ด ${count} ๊ณณ`, | ||
COMPANY_INFO: 'ํ์ฌ ์ ๋ณด', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const EmployerMyPage = { | ||
GREETING: 'Chแปง doanh nghiแปp, xin chร o!', | ||
REGISTER_SIGN: 'ฤฤng kรฝ chแปฏ kรฝ', | ||
MY_COMPANIES: 'Cรดng ty cแปงa tรดi', | ||
TOTAL_COMPANIES: (count: number) => `Tแปng cแปng ${count} cรดng ty`, | ||
COMPANY_INFO: 'Thรดng tin cรดng ty', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export const MyCompany = { | ||
MY_RECRUITMENTS: '๋ด ๊ณต๊ณ ๊ธ', | ||
TOTAL_RECRUITMENTS: (count: number) => `์ด ${count}๊ฑด`, | ||
TABLE_HEADERS: { | ||
LOCATION: '๊ทผ๋ฌด์ง', | ||
TITLE: '๊ณต๊ณ ์ ๋ชฉ', | ||
}, | ||
BUTTONS: { | ||
VIEW_APPLICANTS: '์ง์์ ๋ณด๋ฌ๊ฐ๊ธฐ', | ||
CLOSE_RECRUITMENT: '๋ง๊ฐํ๊ธฐ', | ||
CLOSED_RECRUITMENT: '๋ง๊ฐ์๋ฃ', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export const MyCompany = { | ||
MY_RECRUITMENTS: 'Thรดng bรกo tuyแปn dแปฅng cแปงa tรดi', | ||
TOTAL_RECRUITMENTS: (count: number) => `Tแปng cแปng ${count} bร i`, | ||
TABLE_HEADERS: { | ||
LOCATION: 'Nฦกi lร m viแปc', | ||
TITLE: 'Tiรชu ฤแป thรดng bรกo', | ||
}, | ||
BUTTONS: { | ||
VIEW_APPLICANTS: 'Xem ngฦฐแปi แปฉng tuyแปn', | ||
CLOSE_RECRUITMENT: 'ฤรณng tuyแปn dแปฅng', | ||
CLOSED_RECRUITMENT: 'ฤรฃ ฤรณng tuyแปn dแปฅng', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const RegisterVisa = { | ||
TITLE: '์ธ๊ตญ์ธ ๋ฒํธ ๋ฐ ๋น์ ๋ฐ๊ธ ์ผ์ ๋ฑ๋ก', | ||
LABELS: { | ||
FOREIGNER_NUMBER: '์ธ๊ตญ์ธ ๋ฒํธ', | ||
VISA_GENERATE_DATE: '๋น์ ๋ฐ๊ธ ์ผ์', | ||
}, | ||
SUBMIT: '๋ฑ๋กํ๊ธฐ', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const RegisterVisa = { | ||
TITLE: 'ฤฤng kรฝ sแป ngฦฐแปi nฦฐแปc ngoร i vร ngร y cแบฅp thแป thแปฑc', | ||
LABELS: { | ||
FOREIGNER_NUMBER: 'Sแป ngฦฐแปi nฦฐแปc ngoร i', | ||
VISA_GENERATE_DATE: 'Ngร y cแบฅp thแป thแปฑc', | ||
}, | ||
SUBMIT: 'ฤฤng kรฝ', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { userLocalStorage } from '@/utils/storage'; | ||
import { createContext, ReactNode, useContext, useEffect, useState } from 'react'; | ||
|
||
type LanguageContextType = { | ||
language: string; | ||
setLanguage: (language: string) => void; | ||
}; | ||
|
||
const LanguageContext = createContext<LanguageContextType | undefined>(undefined); | ||
|
||
export const LanguageProvider = ({ children }: { children: ReactNode }) => { | ||
const [language, setLanguage] = useState<string>(() => userLocalStorage.getLanguage() || 'korean'); | ||
|
||
useEffect(() => { | ||
const handleStorageChange = (event: StorageEvent) => { | ||
if (event.key === 'language') { | ||
const newLanguage = event.newValue ? JSON.parse(event.newValue) : 'korean'; | ||
setLanguage(newLanguage); | ||
} | ||
}; | ||
|
||
window.addEventListener('storage', handleStorageChange); | ||
return () => window.removeEventListener('storage', handleStorageChange); | ||
}, []); | ||
|
||
const updateLanguage = (newLanguage: string) => { | ||
userLocalStorage.setLanguage(newLanguage); | ||
setLanguage(newLanguage); | ||
}; | ||
|
||
return ( | ||
<LanguageContext.Provider value={{ language, setLanguage: updateLanguage }}>{children}</LanguageContext.Provider> | ||
); | ||
}; | ||
|
||
export const useLanguage = () => { | ||
const context = useContext(LanguageContext); | ||
if (!context) { | ||
throw new Error('useLanguage must be used within a LanguageProvider'); | ||
} | ||
return context; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { ReactNode } from 'react'; | ||
import { createContext, useContext, useEffect, useState } from 'react'; | ||
|
||
import { UserData } from '@/types'; | ||
import { userLocalStorage } from '@/utils/storage'; | ||
|
||
type UserContextType = { | ||
user: UserData | undefined; | ||
setUser: React.Dispatch<React.SetStateAction<UserData | undefined>>; | ||
}; | ||
|
||
export const UserContext = createContext<UserContextType | undefined>(undefined); | ||
|
||
export const UserProvider = ({ children }: { children: ReactNode }) => { | ||
const [user, setUser] = useState<UserData | undefined>(() => userLocalStorage.getUser()); | ||
|
||
useEffect(() => { | ||
const changeUser = () => { | ||
const updatedUser = userLocalStorage.getUser(); | ||
setUser(updatedUser); | ||
}; | ||
|
||
window.addEventListener('storage', changeUser); | ||
|
||
return () => window.removeEventListener('storage', changeUser); | ||
}, []); | ||
|
||
return <UserContext.Provider value={{ user, setUser }}>{children}</UserContext.Provider>; | ||
}; | ||
|
||
export const useUser = () => { | ||
const context = useContext(UserContext); | ||
if (!context) { | ||
throw new Error('useUser must be used within a UserProvider'); | ||
} | ||
return context; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.