Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: console 삭제 및 안쓰는 slice 삭제 #126

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 14 additions & 33 deletions src/api/boardApi.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { publicApi, privateApi } from './Instance'

export const getMainPostList = async (params: IMainListPayload, page = 1) => {
console.log(params)
return await publicApi.get(`/search/${page}`, { params }).then((res) => {
return res.data.data
})
Expand All @@ -16,9 +15,7 @@ export const getPostDetail = async (userId: number, loginVal: boolean) => {
}

export const delPost = async (boardId: number | undefined) => {
return await privateApi.delete(`/board/delete/${boardId}`).then(() => {
return
})
return await privateApi.delete(`/board/delete/${boardId}`)
}

export const getComment = async (boardId: number, page: number, loginVal: boolean) => {
Expand All @@ -42,46 +39,30 @@ export const postComment = async (boardId: number, comment: string, parentId?: n

export const postLikeBoard = async (boardId: number, loginVal: boolean) => {
if (!loginVal) return false
return await privateApi
.post('/board/register/wish-list', {
boardId: boardId,
})
.then(() => {
return
})
return await privateApi.post('/board/register/wish-list', {
boardId: boardId,
})
}

export const delLikeBoard = async (boardId: number) => {
return await privateApi
.delete('board/delete/wish-list', {
data: {
boardId: boardId,
},
})
.then(() => {
return
})
return await privateApi.delete('board/delete/wish-list', {
data: {
boardId: boardId,
},
})
}

export const delComment = async (commentId: number) => {
return await privateApi.delete(`/comment/delete/${commentId}`).then(() => {
return
})
return await privateApi.delete(`/comment/delete/${commentId}`)
}
export const addComment = async (commentId: number, content: string) => {
return await privateApi
.put(`/comment/edit/${commentId}`, {
commentContent: content,
})
.then(() => {
return
})
return await privateApi.put(`/comment/edit/${commentId}`, {
commentContent: content,
})
}

export const addTransactionStatus = async (commentId: number) => {
return await privateApi.put(`/board/sold-out/${commentId}`).then(() => {
alert('변경 되었습니다.')
})
return await privateApi.put(`/board/sold-out/${commentId}`)
}

// 게시글 블라인드 처리
Expand Down
8 changes: 7 additions & 1 deletion src/components/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { BalloonIcon, ClackIcon, MoreIcon } from '@src/constants/icons'
import { dateFormat } from '@src/utils/utils'
import CommentOptions from '../components/CommentOptions'
import { setCommentAdd, setCommentInput, setCommentOptions } from '@src/store/slices/commentSlice'
import useModal from '@src/hooks/useModal'

type PropsType = {
boardId: number
Expand All @@ -19,6 +20,7 @@ const BoardComment = (props: PropsType) => {
const [comments, setComments] = useState<CommentTypes[]>([])
const dispatch = useDispatch()
const [totalPage, setTotalPage] = useState<number[]>([])
const { openModal } = useModal()

//element
const commentMoreBtn = useRef<HTMLButtonElement>(null)
Expand All @@ -45,7 +47,11 @@ const BoardComment = (props: PropsType) => {
setTotalPage(total)
setComments(CommentData.content)
} catch (err) {
console.log(err)
openModal({
isModalOpen: true,
isConfirm: false,
content: ['오류가 발생했습니다 다시 시도해주세요.'],
})
}
},
[commentData.data, commentData.commentAdd, page]
Expand Down
8 changes: 4 additions & 4 deletions src/pages/BoardDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ const BoardDetails = () => {
isModalOpen: true,
isConfirm: true,
content: ['게시글을 양도완료 상태로 변경하시겠습니까?'],
confirmAction: () => {
confirmAction: async () => {
try {
addTransactionStatus(detailData?.boardId || 0)
await addTransactionStatus(detailData?.boardId as number)
openModal({
isModalOpen: true,
isConfirm: false,
Expand Down Expand Up @@ -262,9 +262,9 @@ const BoardDetails = () => {
isModalOpen: true,
isConfirm: true,
content: ['게시글을 양도완료 상태로 변경하시겠습니까?'],
confirmAction: () => {
confirmAction: async () => {
try {
addTransactionStatus(detailData?.boardId || 0)
await addTransactionStatus(detailData?.boardId || 0)
openModal({
isModalOpen: true,
isConfirm: false,
Expand Down
2 changes: 0 additions & 2 deletions src/store/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import storage from 'redux-persist/lib/storage'
import testSlice from './slices/testSlice'
import authReducer from './slices/authSlice'
import searchVlaue from './slices/searchVlaueSlice'
import postData from './slices/postDataSlice'
import infoSlice from './slices/infoSlice'
import wishlistSlice from './slices/wishlistSlice'
import { setupListeners } from '@reduxjs/toolkit/dist/query'
Expand All @@ -17,7 +16,6 @@ const rootReducer = combineReducers({
createTest: testSlice.reducer,
accessToken: authReducer.reducer,
searchVlaue: searchVlaue.reducer,
postData: postData.reducer,
userInfo: infoSlice.reducer,
wishlist: wishlistSlice.reducer,
searchBox: searchBox.reducer,
Expand Down
17 changes: 0 additions & 17 deletions src/store/slices/postDataSlice.tsx

This file was deleted.