Skip to content

Commit

Permalink
[fix] hook 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
harin0707 committed May 30, 2024
1 parent 31fd426 commit 6585859
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/components/modal/NewIssue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import InputDesc from '../input/InputDesc';
import PriorityToggle from '../input/PriorityToggle';
import { NewIssue } from '@/types/type';
import { issueTitleState, issuePriority, issueDescState } from '@/recoil/issueState';
import createNewIssue from '@/hooks/createNewIssue';
import useCreateNewIssue from '@/hooks/createNewIssue';

interface IssueProps {
onIssueCreated: () => void;
Expand All @@ -19,7 +19,7 @@ const NewIssue = ({onIssueCreated }: IssueProps) => {
const [issuePrior, setIssuePrior] = useRecoilState(issuePriority);
const [issueDesc, setIssueDesc] = useRecoilState(issueDescState);

const {create, error, data} = createNewIssue();
const {create, error, data} = useCreateNewIssue();

const [isVisible, setVisiable] = useRecoilState(modalState);

Expand Down
4 changes: 2 additions & 2 deletions src/components/modal/NewProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Input from '../Input';
import InputToggle from '../InputToggle';
import {useRecoilState} from 'recoil';
import { titleState, contributerId, modalState, contributerName} from '@/recoil/state';
import createNewProject from '@/hooks/createNewProject';
import useCreateNewProject from '@/hooks/createNewProject';
import SubmitBtn from '../button/SubmitBtn';
import { User } from '@/types/type';

Expand All @@ -21,7 +21,7 @@ const NewProject = ({userData, onProjectCreated}:UserProps )=> {
const userId = parseInt(localStorage.getItem('userId')||'0');
const [isVisible, setVisiable] = useRecoilState(modalState);

const {create, loading, error, data} = createNewProject();
const {create, loading, error, data} = useCreateNewProject();

const handleSubmit = async (e:React.FormEvent<HTMLFormElement>)=>{
e.preventDefault();
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/createNewIssue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {useRouter} from 'next/router';



const createNewIssue = () => {
const useCreateNewIssue = () => {
const [error, setError] = useState<string|null>(null);
const [data, setData] = useState<any>(null);

Expand Down Expand Up @@ -62,5 +62,5 @@ const createNewIssue = () => {
return{create, error, data};
};

export default createNewIssue;
export default useCreateNewIssue;

4 changes: 2 additions & 2 deletions src/hooks/createNewProject.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from 'react';

const createNewProject = () => {
const useCreateNewProject = () => {
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string|null>(null);
const [data, setData] = useState<any>(null);
Expand Down Expand Up @@ -55,5 +55,5 @@ const createNewProject = () => {
return{create, loading, error, data};
};

export default createNewProject;
export default useCreateNewProject;

4 changes: 2 additions & 2 deletions src/hooks/deleteComment.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const deleteComment = async (commentId: string): Promise<boolean> => {
const useDeleteComment = async (commentId: string): Promise<boolean> => {
try {
const url = `${process.env.NEXT_PUBLIC_API_BASE_URL}/comments?commentId=${commentId}`;
const response = await fetch(url, {
Expand All @@ -19,4 +19,4 @@ const deleteComment = async (commentId: string): Promise<boolean> => {
}
};

export default deleteComment;
export default useDeleteComment;
4 changes: 2 additions & 2 deletions src/pages/issue/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CommentInfo, IssueInfo, NewComment } from '@/types/type';
import useFetchIssueDetail from '../../hooks/useFetchIssueDetail';
import useFetchComment from '@/hooks/useFetchComment';
import useAddComment from '@/hooks/useAddComment';
import deleteComment from '@/hooks/deleteComment';
import useDeleteComment from '@/hooks/deleteComment';
import { useRouter } from 'next/router';
import Navbar from '@/components/nav/Navbar';

Expand Down Expand Up @@ -76,7 +76,7 @@ const Issue = () => {

const handleDeleteComment = async (commentId:string) =>{
try {
const deleted = await deleteComment(commentId);
const deleted = await useDeleteComment(commentId);
if (deleted) {
setComments(comments.filter(comment => comment.id !== Number(commentId)));
}
Expand Down
2 changes: 0 additions & 2 deletions src/pages/project/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { modalState } from '@/recoil/state';
import useFetchData from '@/hooks/useFetchData';
import useFetchProject from '@/hooks/useFetchProject';
import { User, ProjectInfo } from '@/types/type';
import { setCookie, getCookie } from '@/utils/cookie';
import Cookies from 'js-cookie';
import { userIdState } from '@/recoil/userState';
import Navbar from '@/components/nav/Navbar';

Expand Down

0 comments on commit 6585859

Please sign in to comment.