Skip to content

Commit

Permalink
Fix: linter 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
eunji-0623 committed Jun 12, 2024
1 parent 6af42a7 commit 2c5be91
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 52 deletions.
10 changes: 5 additions & 5 deletions src/api/comments/apiComments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface GetCommentListResponse {

// 댓글 생성 api
export async function apiCreateComments(
body: CreateCommentBody
body: CreateCommentBody,
): Promise<CommentOverAll> {
const res = await instance.post<CommentOverAll>('/comments', body);
return handleResponse(res);
Expand All @@ -52,12 +52,12 @@ interface Params {
export async function apiGetCommentList(
cardId: number,
cursorId: number = 0,
size: number = 10
size: number = 10,
): Promise<GetCommentListResponse> {
const params: Params = {};

params.cardId = cardId;
size ? (params.size = size) : (params.size = 10);
params.size = size;
if (cursorId) {
params.cursorId = cursorId;
}
Expand All @@ -72,11 +72,11 @@ export async function apiGetCommentList(
// commentId를 파라미터로 받습니다.
export async function apiUpdateComment(
body: UpdateCommentBody,
commentId: number
commentId: number,
): Promise<CommentOverAll> {
const res = await instance.put<CommentOverAll>(
`/comments/${commentId}`,
body
body,
);
return handleResponse(res);
}
Expand Down
26 changes: 14 additions & 12 deletions src/api/dashboards/apiDashboards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ interface InvitationListResponse {

// 대시보드 생성 api
export async function apiCreateDashboards(
body: DashboardOverall
body: DashboardOverall,
): Promise<DashboardDetail> {
const res = await instance.post<DashboardDetail>('/dashboards', body);
return handleResponse(res);
Expand All @@ -94,9 +94,11 @@ export async function apiDashboardsList(
navigationMethod: 'pagination',
page: 1,
size: 10,
}
},
): Promise<DashboardsListResponse> {
const { navigationMethod, cursorId, page, size } = query;
const {
navigationMethod, cursorId, page, size,
} = query;
const params: Params = {};
params.navigationMethod = navigationMethod;
if (cursorId === 0) {
Expand All @@ -110,7 +112,7 @@ export async function apiDashboardsList(

// 대시보드 상세조회 api
export async function apiDashboardsDetail(
path: DashboardsId
path: DashboardsId,
): Promise<DashboardDetail> {
const res = await instance.get(`/dashboards/${path.dashboardId}`);
return handleResponse(res);
Expand All @@ -119,11 +121,11 @@ export async function apiDashboardsDetail(
// 대시보드 수정 api - 생성한 사람만 수정 가능
export async function apiEditDashboards(
body: DashboardOverall,
path: DashboardsId
path: DashboardsId,
): Promise<DashboardDetail> {
const res = await instance.put<DashboardDetail>(
`/dashboards/${path.dashboardId}`,
body
body,
);
return handleResponse(res);
}
Expand All @@ -137,34 +139,34 @@ export async function apiDeleteDashboards(path: DashboardsId) {
// 대시보드 초대 api - 생성한 사람만 초대 가능
export async function apiInviteDashboards(
body: UserEmail,
path: DashboardsId
path: DashboardsId,
): Promise<InvitationResponse> {
const res = await instance.post(
`/dashboards/${path.dashboardId}/invitations`,
body
body,
);
return handleResponse(res);
}

// 대시보드 초대 목록 불러오기 api
export async function apiInvitationList(
path: DashboardsId,
query: InvitationQuery = { page: 1, size: 10 }
query: InvitationQuery = { page: 1, size: 10 },
): Promise<InvitationListResponse> {
const res = await instance.get(
`/dashboards/${path.dashboardId}/invitations`,
{ params: query }
{ params: query },
);
return handleResponse(res);
}

// 대시보드 초대 취소 api
export async function apiDeleteInvitation(
path: DashboardsId,
invitationPath: InvitationId
invitationPath: InvitationId,
) {
const res = await instance.delete(
`/dashboards/${path.dashboardId}/invitations/${invitationPath.invitationId}`
`/dashboards/${path.dashboardId}/invitations/${invitationPath.invitationId}`,
);
return handleResponse(res);
}
2 changes: 1 addition & 1 deletion src/hooks/pagination/usePagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function usePagination<T>({
setTotalPage(
result.totalCount === 0
? 1
: Math.ceil(result.totalCount / itemsPerPage)
: Math.ceil(result.totalCount / itemsPerPage),
);
setIsFirstPage(currentPage === 1);
setIsLastPage(currentPage >= Math.ceil(result.totalCount / itemsPerPage));
Expand Down
5 changes: 4 additions & 1 deletion src/pages/dashboardEdit/MemberEdit/EditHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ function EditHeader({
<h2 className={styles.title}>{title}</h2>
<div className={styles.pagination}>
<p>
{totalPages} 페이지 중 {currentPage}
{totalPages}
{' '}
페이지 중
{currentPage}
</p>
<PagenationBtn
handlePrev={handlePrevClick}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dashboardEdit/MemberEdit/Email.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Email({ email }: Props) {
return (
<tr className={styles.table_row}>
<td className={styles.email}>{email}</td>
<td className={styles.removeButton}>
<td className={styles.removeButton} aria-label="취소 버튼">
<DeleteBtn BtnText="취소" handleBtn={handleCancelButton} />
</td>
</tr>
Expand Down
10 changes: 5 additions & 5 deletions src/pages/dashboardEdit/MemberEdit/EmailEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ interface EmailResponse {

function EmailEdit({ dashboardId }: Props) {
const fetchInvitations = async (
dashboardId: number,
page: number
id: number,
page: number,
): Promise<{ items: EmailResponse[]; totalCount: number }> => {
const data = await apiInvitationList(
{ dashboardId },
{ page: page, size: ITEMS_PER_PAGE }
{ dashboardId: id },
{ page, size: ITEMS_PER_PAGE },
);
return {
items: data.invitations,
Expand All @@ -55,7 +55,7 @@ function EmailEdit({ dashboardId }: Props) {

const fetchDataCallback = useCallback(
() => fetchInvitations(dashboardId, 1),
[dashboardId]
[dashboardId],
);

const {
Expand Down
10 changes: 7 additions & 3 deletions src/pages/dashboardEdit/MemberEdit/Member.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ interface Props {
isOwner: boolean;
}

function Member({ memberId, name, profile, isOwner }: Props) {
function Member({
memberId, name, profile, isOwner,
}: Props) {
const handleDeleteButton = async () => {
await apiDeleteMemeber({ memberId: memberId });
await apiDeleteMemeber({ memberId });
};

return (
Expand All @@ -23,7 +25,9 @@ function Member({ memberId, name, profile, isOwner }: Props) {
<img src={profile} alt="프로필" />
</td>
<td className={styles.name}>
{name} {isOwner ? <img src="/icon/crown.svg" alt="왕관" /> : null}
{name}
{' '}
{isOwner ? <img src="/icon/crown.svg" alt="왕관" /> : null}
</td>
<td className={styles.removeButton}>
{!isOwner ? (
Expand Down
6 changes: 3 additions & 3 deletions src/pages/dashboardEdit/MemberEdit/MemberEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ interface MemberResponse {

function MemberEdit({ dashboardId }: Props) {
const fetchMembers = async (
dashboardId: number
id: number,
): Promise<{ items: MemberResponse[]; totalCount: number }> => {
const data = await apiMemberList({ dashboardId });
const data = await apiMemberList({ dashboardId: id });
return {
items: data.members,
totalCount: data.totalCount,
Expand All @@ -40,7 +40,7 @@ function MemberEdit({ dashboardId }: Props) {

const fetchDataCallback = useCallback(
() => fetchMembers(dashboardId),
[dashboardId]
[dashboardId],
);

const {
Expand Down
20 changes: 15 additions & 5 deletions src/pages/dashboardEdit/NameEdit/Chips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ function Chips({ selectedColor, handleSelectColor }: Props) {
onChange={handleClickChips}
/>
<ColorCircle color={COLORS[0]} diameter={30}>
{selectedColor === COLORS[0] ? <img src="/icon/checked.svg" /> : null}
{selectedColor === COLORS[0] ? (
<img src="/icon/checked.svg" alt="체크" />
) : null}
</ColorCircle>
</label>
<label>
Expand All @@ -35,7 +37,9 @@ function Chips({ selectedColor, handleSelectColor }: Props) {
onChange={handleClickChips}
/>
<ColorCircle color={COLORS[1]} diameter={30}>
{selectedColor === COLORS[1] ? <img src="/icon/checked.svg" /> : null}
{selectedColor === COLORS[1] ? (
<img src="/icon/checked.svg" alt="체크" />
) : null}
</ColorCircle>
</label>
<label>
Expand All @@ -46,7 +50,9 @@ function Chips({ selectedColor, handleSelectColor }: Props) {
onChange={handleClickChips}
/>
<ColorCircle color={COLORS[2]} diameter={30}>
{selectedColor === COLORS[2] ? <img src="/icon/checked.svg" /> : null}
{selectedColor === COLORS[2] ? (
<img src="/icon/checked.svg" alt="체크" />
) : null}
</ColorCircle>
</label>
<label>
Expand All @@ -57,7 +63,9 @@ function Chips({ selectedColor, handleSelectColor }: Props) {
onChange={handleClickChips}
/>
<ColorCircle color={COLORS[3]} diameter={30}>
{selectedColor === COLORS[3] ? <img src="/icon/checked.svg" /> : null}
{selectedColor === COLORS[3] ? (
<img src="/icon/checked.svg" alt="체크" />
) : null}
</ColorCircle>
</label>
<label>
Expand All @@ -68,7 +76,9 @@ function Chips({ selectedColor, handleSelectColor }: Props) {
onChange={handleClickChips}
/>
<ColorCircle color={COLORS[4]} diameter={30}>
{selectedColor === COLORS[4] ? <img src="/icon/checked.svg" /> : null}
{selectedColor === COLORS[4] ? (
<img src="/icon/checked.svg" alt="체크" />
) : null}
</ColorCircle>
</label>
</div>
Expand Down
10 changes: 7 additions & 3 deletions src/pages/dashboardEdit/NameEdit/NameEdit.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { useState, useEffect, Dispatch, SetStateAction } from 'react';
import {
useState, useEffect, Dispatch, SetStateAction,
} from 'react';
import styles from './NameEdit.module.scss';
import { ChangeAndSaveBtn } from '../../../components/Btn/Btn';
import { apiEditDashboards } from '../../../api/apiModule';
Expand All @@ -14,7 +16,9 @@ interface Props {
handleChange: Dispatch<SetStateAction<string>>;
}

function Info({ name, color, dashboardId, handleChange }: Props) {
function Info({
name, color, dashboardId, handleChange,
}: Props) {
const [newName, setNewName] = useState('');
const [selectedColor, setSelectedColor] = useState(color);

Expand All @@ -26,7 +30,7 @@ function Info({ name, color, dashboardId, handleChange }: Props) {
handleChange(newName);
await apiEditDashboards(
{ title: newName, color: selectedColor },
{ dashboardId: dashboardId }
{ dashboardId },
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/pages/dashboardEdit/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect, useState } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import { apiDashboardsDetail } from '../../api/apiModule';
import SideBar from '../../components/sidebar/sidebar';
Expand All @@ -6,7 +7,6 @@ import EmailEdit from './MemberEdit/EmailEdit';
import MemberEdit from './MemberEdit/MemberEdit';
import NameEdit from './NameEdit/NameEdit';
import styles from './index.module.scss';
import { useEffect, useState } from 'react';
import { DeleteDashBoardBtn } from '../../components/Btn/Btn';
import DeleteDashboardModal from '../modal/DeleteDashboardModal/DeleteDashboardModal';

Expand Down
4 changes: 2 additions & 2 deletions src/pages/modal/DeleteDashboardModal/DeleteDashboardModal.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import ModalContainer from '../ModalContainer/ModalContainer';
import { DeleteBtn, ChangeAndSaveBtn } from '../../../components/Btn/Btn';
import styles from './DeleteDashboardModal.module.scss';
import { apiDeleteDashboards } from '../../../api/apiModule';
import { useNavigate, Link } from 'react-router-dom';

/*
컬럼 삭제할 수 있는 모달입니다.
Expand All @@ -23,7 +23,7 @@ function DeleteDashboardModal({ isOpen, setIsOpen, dashboardId }: ModalProps) {
}, [setIsOpen]);

const handleDeleteButton = async () => {
await apiDeleteDashboards({ dashboardId: dashboardId });
await apiDeleteDashboards({ dashboardId });
navigate('/myDashboard');
};

Expand Down
6 changes: 4 additions & 2 deletions src/pages/myDashboard/components/DashboardList/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useNavigate } from 'react-router-dom';
import styles from './Dashboard.module.scss';
import ColorDot from '../../../../components/chip/ColorCircle/ColorDot';
import { useNavigate } from 'react-router-dom';
import useNewDashModal from '../../../../hooks/modal/useNewDashModal';

interface DashboardButtonProps {
Expand All @@ -26,7 +26,9 @@ export function AddDashboard() {
}

/* 각각의 대시보드로 이동하기 위한 버튼 */
export function Dashboard({ id, color, title, isOwner }: DashboardButtonProps) {
export function Dashboard({
id, color, title, isOwner,
}: DashboardButtonProps) {
const navigate = useNavigate();
const handleClick = () => {
navigate(`/dashboard/${id}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface DashboardDetail {
const ITEMS_PER_PAGE = 5;

const fetchDashboards = async (
page: number
page: number,
): Promise<{
items: DashboardDetail[];
totalCount: number;
Expand Down Expand Up @@ -71,7 +71,8 @@ function DashboardList() {
<div className={styles.pagination}>
<p>
{totalPages}
페이지 중{currentPage}
페이지 중
{currentPage}
</p>
<PagenationBtn
handlePrev={handlePrevClick}
Expand Down
Loading

0 comments on commit 2c5be91

Please sign in to comment.