fix: 오류 수정

- 예약 물품 조회 시 인터넷 예약만 조회됨 -> 모든 예약물품 조회
This commit is contained in:
shinmj
2021-12-30 21:54:18 +09:00
parent 016cb069a9
commit 5348bcfe92
11 changed files with 24 additions and 17 deletions

View File

@@ -1,10 +1,10 @@
import React, { useEffect, useState } from 'react'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { useSnackbar } from 'notistack'
import { errorStateAtom } from '@stores'
import { useRecoilState } from 'recoil'
import CustomAlert from '@components/CustomAlert' import CustomAlert from '@components/CustomAlert'
import { ButtonProps } from '@material-ui/core/Button' import { ButtonProps } from '@material-ui/core/Button'
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { errorStateAtom } from '@stores'
import { useSnackbar } from 'notistack'
import React, { useEffect, useState } from 'react'
import { useRecoilState } from 'recoil'
const useStyles = makeStyles((theme: Theme) => const useStyles = makeStyles((theme: Theme) =>
createStyles({ createStyles({
@@ -39,7 +39,7 @@ const GlobalError = () => {
if (errorState.error) { if (errorState.error) {
if (errorState.status === 400) { if (errorState.status === 400) {
const errors = errorState.errors.map(item => { const errors = errorState.errors.map(item => {
return item.defaultMessage return item.defaultMessage || item.message
}) })
setAlertState({ setAlertState({

View File

@@ -205,6 +205,7 @@ const ReserveItem = (props: ReserveItemProps) => {
categoryId: categoryId:
keywordState?.categoryId !== 'all' ? keywordState?.categoryId : null, keywordState?.categoryId !== 'all' ? keywordState?.categoryId : null,
isUse: Boolean(handlePopup), isUse: Boolean(handlePopup),
isPopup: Boolean(handlePopup),
}) })
//목록 조회 //목록 조회

View File

@@ -106,6 +106,7 @@ interface ReserveItemSearchPayload extends SearchPayload {
locationId?: string locationId?: string
categoryId?: string categoryId?: string
isUse?: boolean isUse?: boolean
isPopup?: boolean
} }
export const reserveItemService = { export const reserveItemService = {
@@ -117,6 +118,7 @@ export const reserveItemService = {
locationId, locationId,
categoryId, categoryId,
isUse = false, isUse = false,
isPopup = false,
}: ReserveItemSearchPayload) => { }: ReserveItemSearchPayload) => {
return useSWR<Page, AxiosError>( return useSWR<Page, AxiosError>(
[ [
@@ -126,6 +128,7 @@ export const reserveItemService = {
locationId, locationId,
categoryId, categoryId,
isUse, isUse,
isPopup,
], ],
url => url =>
common.fetcher(url, { common.fetcher(url, {
@@ -134,6 +137,7 @@ export const reserveItemService = {
locationId, locationId,
categoryId, categoryId,
isUse, isUse,
isPopup,
}), }),
{ revalidateOnFocus: false, errorRetryCount: 0 }, { revalidateOnFocus: false, errorRetryCount: 0 },

View File

@@ -1,6 +1,6 @@
import { DEFAULT_ERROR_MESSAGE } from '@constants'
import { AxiosError } from 'axios' import { AxiosError } from 'axios'
import { atom, DefaultValue, selector } from 'recoil' import { atom, DefaultValue, selector } from 'recoil'
import { DEFAULT_ERROR_MESSAGE } from '@constants'
/** /**
* Global error 상태관리 * Global error 상태관리
@@ -10,6 +10,7 @@ interface IErrors {
defaultMessage: string defaultMessage: string
field: string field: string
rejectedValue?: string rejectedValue?: string
message?: string
} }
export interface IErrorProps { export interface IErrorProps {

View File

@@ -27,6 +27,10 @@ const ReserveItemAdditional = ({ data }: ReserveItemAdditionalPropps) => {
<dt>{t('reserve_item.contact')}</dt> <dt>{t('reserve_item.contact')}</dt>
<dd>{data.contact}</dd> <dd>{data.contact}</dd>
</dl> </dl>
<dl>
<dt>{'주소'}</dt>
<dd>{data.address}</dd>
</dl>
</div> </div>
)} )}
<h4>{t('reserve_item.manager')}</h4> <h4>{t('reserve_item.manager')}</h4>

View File

@@ -27,6 +27,10 @@ const ReserveItemInfo = ({ data, reserveStatus }: ReserveItemInfoProps) => {
<dt>{t('reserve_item.name')}</dt> <dt>{t('reserve_item.name')}</dt>
<dd>{data.reserveItemName}</dd> <dd>{data.reserveItemName}</dd>
</dl> </dl>
<dl>
<dt>{'예약방법'}</dt>
<dd>{data.reserveMethodName}</dd>
</dl>
<dl> <dl>
<dt>{`${t('reserve.count')}/${t('reserve.number_of_people')}`}</dt> <dt>{`${t('reserve.count')}/${t('reserve.number_of_people')}`}</dt>
<dd>{data.totalQty}</dd> <dd>{data.totalQty}</dd>

View File

@@ -21,7 +21,6 @@ export const getServerSideProps: GetServerSideProps = async ({
res, res,
query, query,
}) => { }) => {
console.log(query)
if (!process.browser) { if (!process.browser) {
const Cookies = require('cookies') const Cookies = require('cookies')
const cookies = new Cookies(req, res) const cookies = new Cookies(req, res)

View File

@@ -37,7 +37,7 @@ const ReserveDetail = ({ initData }: ReserveDetailProps) => {
}, },
] ]
if (initData?.isPossible) { if (initData?.isPossible && initData?.reserveMethodId === 'internet') {
buttons.push({ buttons.push({
id: 'item-edit-button', id: 'item-edit-button',
title: t('reserve_item.request'), title: t('reserve_item.request'),

View File

@@ -40,7 +40,6 @@ const UserLeave = () => {
// 탈퇴 처리 // 탈퇴 처리
const leave = async (data: IVerification) => { const leave = async (data: IVerification) => {
console.log('leave', data)
try { try {
const result = await userService.leave(data) const result = await userService.leave(data)
if (result === true) { if (result === true) {

View File

@@ -22,7 +22,7 @@ import { conditionAtom, conditionValue, userAtom } from '@stores'
import { rownum } from '@utils' import { rownum } from '@utils'
import { GetServerSideProps } from 'next' import { GetServerSideProps } from 'next'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import React, { createRef, useEffect, useMemo, useState } from 'react' import React, { createRef, useMemo, useState } from 'react'
import { TFunction, useTranslation } from 'react-i18next' import { TFunction, useTranslation } from 'react-i18next'
import { useRecoilValue } from 'recoil' import { useRecoilValue } from 'recoil'
@@ -239,12 +239,6 @@ const UserReserve = (props: UserReserveProps) => {
keywordState?.categoryId !== 'all' ? keywordState?.categoryId : null, keywordState?.categoryId !== 'all' ? keywordState?.categoryId : null,
}) })
useEffect(() => {
if (data) {
console.log(data)
}
}, [data])
const handleSearch = () => { const handleSearch = () => {
if (page === 0) { if (page === 0) {
mutate(data, false) mutate(data, false)

View File

@@ -147,6 +147,7 @@ export const reserveService = {
locationId, locationId,
categoryId, categoryId,
isUse: true, isUse: true,
isPopup: false,
}), }),
{ revalidateOnFocus: false, errorRetryCount: 0 }, { revalidateOnFocus: false, errorRetryCount: 0 },
), ),