-
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
[ Feature/subscription 75 ] 구독 & 구독 취소 API 연결 #78
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
554bc66
refactor: divide subscription and workbook
soomin9106 f50ec61
refactor: migrate subscribe bottom bar main to subscription
soomin9106 54ec84d
feat: redirect /workbook to /workbook/1
soomin9106 4293852
chore: add github domain in next js image
soomin9106 b6f9609
feat: subscribe API 연결
soomin9106 a2c81b9
feat: unsubscribe API
soomin9106 68edba2
chore: change file name
soomin9106 dd5e9b1
refactor: interface to type using Omit
soomin9106 6aac329
refactor: return if conditional statement is not met
soomin9106 c74e82c
refactor: use destructuring assignment
soomin9106 9553999
refactor: add onSubmit mode and remove safeParse
soomin9106 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
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
export const API_ROUTE = { | ||
SUBSCRIBE: (workbookId: string) => `/api/v1/workbooks/${workbookId}/subs`, | ||
UNSUBSCRIBE: () => `/api/v1/subscriptions/unsubs` | ||
}; | ||
export const QUERY_KEY = { | ||
SUBSCRIBE_WORKBOOK: "sub-workbook", | ||
UNSUBSCRIBE_WORKBOOK: "unsub-workbook" | ||
}; |
27 changes: 27 additions & 0 deletions
27
src/subscription/remotes/postUnsubscriptionQueryOptions.ts
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,27 @@ | ||
import { UseMutationOptions } from "@tanstack/react-query"; | ||
|
||
import { ApiResponse, axiosRequest } from "@api/api-config"; | ||
|
||
import { | ||
MessageOnlyResponse, | ||
UnsubscribeBody, | ||
} from "@subscription/types/subscription"; | ||
|
||
import { API_ROUTE, QUERY_KEY } from "./api"; | ||
|
||
export const unsubscribeWorkbook = ( | ||
body: UnsubscribeBody, | ||
): Promise<ApiResponse<MessageOnlyResponse>> => { | ||
return axiosRequest("post", API_ROUTE.UNSUBSCRIBE(), body); | ||
}; | ||
|
||
export const unsubscribeWorkbookOptions = (): UseMutationOptions< | ||
ApiResponse<MessageOnlyResponse>, | ||
Error, | ||
UnsubscribeBody | ||
> => { | ||
return { | ||
mutationKey: [QUERY_KEY.UNSUBSCRIBE_WORKBOOK], | ||
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. body값에 있는 email 키를 넣어서 mutation key를 유효하게 만드는건 어떤가욥...? |
||
mutationFn: (body) => unsubscribeWorkbook(body), | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const getCookie = (name: string) => { | ||
const value = `; ${document.cookie}`; | ||
const parts = value.split(`; ${name}=`); | ||
if (parts.length === 2) return parts.pop()?.split(";").shift(); | ||
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. 조건문에 해당되지 않을때 반환하는게 있다면 더 명시적일것같습니다..! |
||
}; |
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.
근데 이거 제출할때 zod가 유효성 검사 해주지 않나요?! 왜 한번더 진행하는걸까욥..?