Skip to content

Commit

Permalink
[WEB] fix : 이슈 생성 안되는 버그 수정
Browse files Browse the repository at this point in the history
이슈 생성 안되는 버그를 수정했습니다.
  • Loading branch information
2hoyeong committed Nov 13, 2020
1 parent 90139c3 commit b88e851
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion backend/services/issueService.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const create = async (req, res) => {
const { issueId } = await Issue.create(data);
const label = req.body.label;
console.log(label);
if (label.length) {
if (label && label.length) {
label.forEach(async (name) => {
await IssueLabel.create({ issueId, name });
});
Expand Down
48 changes: 26 additions & 22 deletions frontend/src/components/Issue/IssueInputButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,32 @@ const IssueInputButtons = () => {

const submitIssue = async () => {
if (selections.title.length > 0) {
let data = {
title: selections.title
}
if (selections.milestoneId.length == 0 && selections.assignees.length == 0) {
data = {
title: selections.title
}
} else if (selections.assignees.length == 0) {
data = {
title: selections.title,
milestoneId: selections.milestoneId,
}
} else if (selections.milestoneId.length == 0) {
data = {
title: selections.title,
assignees: selections.assignees,
}
}

const result = await axios.post('http://api.hoyoung.me/api/issue', {
data
}, { withCredentials: true });
let data = {
title: selections.title,
};
if (selections.milestoneId.length == 0 && selections.assignees.length == 0) {
data = {
title: selections.title,
};
} else if (selections.assignees.length == 0) {
data = {
title: selections.title,
milestoneId: selections.milestoneId,
};
} else if (selections.milestoneId.length == 0) {
data = {
title: selections.title,
assignees: selections.assignees,
};
}

const result = await axios.post(
'http://api.hoyoung.me/api/issue',
{
...data,
},
{ withCredentials: true },
);

if (result.status === 200) {
window.location.href = '/issue';
Expand Down

0 comments on commit b88e851

Please sign in to comment.