-
Notifications
You must be signed in to change notification settings - Fork 1
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
[#543] [모임 생성] 책 선택 퍼널 #560
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ffeb085
feat: input에 leftIconType prop 추가
gxxrxn f531089
type: SearchedBookWithId 타입 추가
gxxrxn 1c62fc2
style: input 컴포넌트에 자동완성 배경색 제거
gxxrxn 181e8fc
feat: storybook query params, post 요청 대응가능하도록 수정
gxxrxn 417faae
feat: 책 선택 스텝 구현
gxxrxn f6aec62
feat: 책 선택 스텝 스토리 작성
gxxrxn a3c0382
refactor: SelectBookStep 이름 수정
gxxrxn 21a2b34
fix: SelectBookStep 오타 수정
gxxrxn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,15 +17,43 @@ const serviceApi = (path: string) => | |
|
||
initialize({}, [ | ||
rest.get(nextApi('/service-api/*'), async (req, res, ctx) => { | ||
const { pathname } = req.url; | ||
const { pathname, search } = req.url; | ||
const match = /\/service-api(?<path>.*)/g.exec(pathname); | ||
|
||
if (!match || !match.groups || !match.groups.path) { | ||
return res(ctx.status(404, 'Invalid Request URL')); | ||
} | ||
|
||
const { path } = match.groups; | ||
const originResponse = await ctx.fetch(serviceApi(`/api${path}`)); | ||
const originResponse = await ctx.fetch(serviceApi(`/api${path}${search}`)); | ||
const originResponseData = await originResponse.json(); | ||
|
||
return res(ctx.json({ ...originResponseData })); | ||
}), | ||
rest.post(nextApi('/service-api/*'), async (req, res, ctx) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const { pathname, search } = req.url; | ||
const match = /\/service-api(?<path>.*)/g.exec(pathname); | ||
|
||
if (!match || !match.groups || !match.groups.path) { | ||
return res(ctx.status(404, 'Invalid Request URL')); | ||
} | ||
|
||
const { path } = match.groups; | ||
|
||
const { headers, mode } = req; | ||
const data = await req.json(); | ||
const body = JSON.stringify(data); | ||
const originRequest = { | ||
method: 'POST', | ||
body, | ||
headers, | ||
mode, | ||
}; | ||
|
||
const originResponse = await ctx.fetch( | ||
serviceApi(`/api${path}${search}`), | ||
originRequest | ||
); | ||
const originResponseData = await originResponse.json(); | ||
|
||
return res(ctx.json({ ...originResponseData })); | ||
|
@@ -55,6 +83,7 @@ initialize({}, [ | |
const queryClient = new QueryClient({ | ||
defaultOptions: { | ||
queries: { | ||
refetchOnWindowFocus: false, | ||
retry: false, | ||
}, | ||
}, | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
38 changes: 38 additions & 0 deletions
38
src/stories/bookGroup/create/funnel/SelectBookStep.stories.tsx
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,38 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { FormProvider, useForm } from 'react-hook-form'; | ||
|
||
import { appLayoutMeta } from '@/stories/meta'; | ||
import SelectBookStep, { | ||
SelectBookFormValue, | ||
} from '@/v1/bookGroup/create/funnel/SelectBookStep'; | ||
|
||
const meta: Meta<typeof SelectBookStep> = { | ||
title: 'bookGroup/funnel/SelectBookStep', | ||
component: SelectBookStep, | ||
...appLayoutMeta, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof SelectBookStep>; | ||
|
||
const RenderSelectBookStep = () => { | ||
const methods = useForm<SelectBookFormValue>(); | ||
|
||
const goNextStep = () => { | ||
const book = methods.getValues('book'); | ||
alert([`title: ${book.title}`, `id: ${book.bookId}`].join('\n')); | ||
}; | ||
|
||
return ( | ||
<FormProvider {...methods}> | ||
<form> | ||
<SelectBookStep onNextStep={goNextStep} /> | ||
</form> | ||
</FormProvider> | ||
); | ||
}; | ||
|
||
export const Default: Story = { | ||
render: RenderSelectBookStep, | ||
}; |
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ const _Select = ( | |
ref={ref} | ||
defaultValue="" | ||
required | ||
className={`rounded-[0.5rem] border-[0.05rem] px-[1.0rem] py-[1.3rem] outline-none ${borderColor} w-full cursor-pointer appearance-none bg-[url('/icons/select-icon.svg')] bg-[length:1.5rem_1.5rem] bg-[calc(100%-1rem)_center] bg-no-repeat invalid:text-placeholder`} | ||
className={`rounded-[0.5rem] border-[0.05rem] px-[1.0rem] py-[1.1rem] outline-none ${borderColor} w-full cursor-pointer appearance-none bg-[url('/icons/select-icon.svg')] bg-[length:1.5rem_1.5rem] bg-[calc(100%-1rem)_center] bg-no-repeat invalid:text-placeholder`} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{...props} | ||
> | ||
{placeholder && ( | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get 요청 시 query parameter를 포함하여 요청을 보내도록 수정했어요.