forked from codesquad-members-2021/issue-tracker
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05e94fd
commit 64ff358
Showing
11 changed files
with
144 additions
and
25 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
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,11 @@ | ||
import atom from '@/utils/myRecoil/atom'; | ||
|
||
export const issueTitleInputAtom = atom({ | ||
key: 'issueTitleInputAtom', | ||
default: '' | ||
}); | ||
|
||
export const issueCommentInputAtom = atom({ | ||
key: 'issueCommentInputAtom', | ||
default: '' | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react' | ||
import Button from '@material-ui/core/Button'; | ||
import { filterCheckboxListAtom } from '@components/common/atoms/filterAtom'; | ||
import { issueTitleInputAtom, issueCommentInputAtom } from '@components/common/atoms/issueInputAtom'; | ||
import { inputStyles } from '@components/common/baseStyle/baseStyle'; | ||
import { useRecoilState } from '@/utils/myRecoil/useRecoilState'; | ||
import API from '@/utils/API'; | ||
|
||
type FilteredIdType = { | ||
info: { | ||
id: number; | ||
} | ||
} | ||
|
||
const SendButton = () => { | ||
const classes = inputStyles(); | ||
const [checkedItems] = useRecoilState(filterCheckboxListAtom); | ||
const [titleInputValue] = useRecoilState(issueTitleInputAtom); | ||
const [commentInputValue] = useRecoilState(issueCommentInputAtom); | ||
|
||
const handleClickSendData = async () => { | ||
|
||
const data = { | ||
title: titleInputValue, | ||
mainCommentContents: commentInputValue, | ||
authorId: 3, //수정필요 | ||
assigneeIds: checkedItems.manager.map(getCheckedItemId), | ||
labelIds: checkedItems.label.map(getCheckedItemId), | ||
milestoneId: checkedItems.milestone.map(getCheckedItemId)[0] | ||
}; | ||
|
||
const a = await API.post.issues(data); | ||
console.log(a); | ||
} | ||
|
||
return ( | ||
<Button color="primary" | ||
variant="contained" | ||
className={classes.button} | ||
onClick={handleClickSendData}> | ||
완료 | ||
</Button> | ||
) | ||
} | ||
|
||
function getCheckedItemId({ info: { id } }: FilteredIdType) { | ||
return id; | ||
} | ||
|
||
export default SendButton; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useRecoilState } from '@/utils/myRecoil/useRecoilState'; | ||
import { AtomType } from '@/utils/myRecoil/atom'; | ||
|
||
const useRecoilInput = <T>(atom: AtomType<T>) => { | ||
const [value, setValue] = useRecoilState(atom); | ||
|
||
const onChange = ({ target }: { target: HTMLInputElement }, fileData?: string) => { | ||
if (fileData) return setValue(value + fileData); | ||
setValue(target.value) | ||
} | ||
|
||
return { value, onChange }; | ||
} | ||
|
||
export default useRecoilInput; |
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,4 +1,4 @@ | ||
type AtomType<T> = { | ||
export type AtomType<T> = { | ||
key: string; | ||
default: T; | ||
} | ||
|