-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix : formData 가져오는 과정에서 worktime이 읽어지지 않는 문제 해결
- worktime을 배열로 받아와서 쉼표로 자르는 부분을 추가함 ref : #18
- Loading branch information
1 parent
5e1f370
commit 021494a
Showing
6 changed files
with
54 additions
and
50 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { verifyCEOAPI, signupUserAPI, signupCEOAPI } from "./signupAPI"; | ||
import { loginAPI } from "./loginAPI"; | ||
import{} from "./postingAPI"; | ||
import{ postJobPosting } from "./postingAPI"; | ||
|
||
export { | ||
verifyCEOAPI, // 사업자 인증 API | ||
signupUserAPI, // 일반유저 회원가입 API | ||
signupCEOAPI, // 사업자유저 회원가입 API | ||
loginAPI, // 로그인 API | ||
postJobPosting, | ||
}; |
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,53 +1,49 @@ | ||
import { privateAxios } from "../utils/customAxios"; | ||
|
||
export const postJobPosting = async (accessToken, dispatch, formData) => { | ||
const { doName, siName, detailName } = formData.workLocation; | ||
const [startHour, startMinute] = formData.workTime.start.split(":").map(Number); | ||
const [endHour, endMinute] = formData.workTime.end.split(":").map(Number); | ||
const workDays = formData.workDays.join(", "); | ||
const { workLocation = "" } = formData; | ||
const [doName = "", siName = "", detailName = ""] = workLocation.split(" "); | ||
const { start = "09:00", end = "18:00" } = formData.workTime || {}; | ||
|
||
const [startHour, startMinute] = start.split(":").map(Number); | ||
const [endHour, endMinute] = end.split(":").map(Number); | ||
const body = { | ||
postId: 0, | ||
userId: 1, | ||
storeName: formData.storeName, | ||
postData: { | ||
doName, | ||
siName, | ||
detailName, | ||
workType: formData.workTags[0] || "기타", | ||
title: formData.title, | ||
content: formData.description, | ||
pay: parseInt(formData.pay, 10), | ||
workStartHour: startHour, | ||
workStartMinute: startMinute, | ||
workEndHour: endHour, | ||
workEndTimeMinute: endMinute, | ||
isNegotiable: formData.isNegotiable || false, | ||
applyNumber: formData.applyNumber, | ||
workDays, | ||
isShortTermJob: formData.workPeriod === "단기", | ||
payType: formData.payType, | ||
isNumberPublic: formData.isNumberPublic, | ||
imageList: [""], // 일단 이미지는 빈 배열로 냅둠 | ||
}, | ||
postId: 0, | ||
userId: 1, | ||
storeName: formData.storeName, | ||
postData: { | ||
doName, | ||
siName, | ||
detailName, | ||
workType: Array.isArray(formData.workTags) && formData.workTags.length > 0 ? formData.workTags[0] : "기타", | ||
title: formData.title, | ||
content: formData.description, | ||
pay: parseInt(formData.pay, 10), | ||
workStartHour: startHour, | ||
workStartMinute: startMinute, | ||
workEndHour: endHour, | ||
workEndTimeMinute: endMinute, | ||
isNegotiable: formData.isNegotiable || false, | ||
applyNumber: formData.applyNumber, | ||
workDays: formData.workDays, | ||
isShortTermJob: formData.workPeriod === "단기", | ||
payType: formData.payType, | ||
isNumberPublic: formData.isNumberPublic, | ||
imageList: [""], | ||
}, | ||
}; | ||
|
||
const response = { | ||
isSuccess: false, | ||
message: "", | ||
}; | ||
|
||
|
||
const response = { isSuccess: false, message: "" }; | ||
|
||
try { | ||
// 서버로 API 호출 | ||
const result = await privateAxios(accessToken, dispatch).post("/post", body); | ||
|
||
if (result.status === 200) { | ||
const result = await privateAxios(accessToken, dispatch).post("/post", body); | ||
if (result.status === 200) { | ||
response.isSuccess = true; | ||
response.message = result.data.message; | ||
} | ||
} | ||
} catch (error) { | ||
response.message = error.message; | ||
response.message = error.message; | ||
} | ||
|
||
return response; | ||
}; | ||
}; |
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