Skip to content

Commit

Permalink
Merge pull request #126 from FC-InnerCircle/feature/#122-fix-cart-add…
Browse files Browse the repository at this point in the history
…ress-change

fix: 카트 주소 미변경 이슈 해결
  • Loading branch information
sionyeom authored Oct 12, 2024
2 parents 9b1ce24 + fb7fb55 commit 3d54670
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 43 deletions.
43 changes: 0 additions & 43 deletions src/app/api/order/route.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/app/my/address/_components/AddressList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { StarFilledIcon } from '@radix-ui/react-icons'
import { Separator } from '@/components/ui/separator'
import { useAddressList, useDeleteAddress, useUpdateMainAddress } from '@/features/address/query'
import { useQueryClient } from '@tanstack/react-query'
import { useRouter } from 'next/navigation'

type AddressData = {
addressId: number
Expand Down Expand Up @@ -34,6 +35,7 @@ const AddressListItem = ({ ...props }: AddressData) => {
const { mutate: deleteAddress } = useDeleteAddress()
const { mutate: updateMainAddress } = useUpdateMainAddress()
const queryClient = useQueryClient()
const router = useRouter()

const handleChangeMainAddress = () => {
if (props.addressStatus === 'main') return
Expand Down
1 change: 1 addition & 0 deletions src/features/address/query/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const useUpdateMainAddress = () => {
onSuccess: () => {
// 성공하면 주소 목록을 다시 가져옴
queryClient.invalidateQueries({ queryKey: ['addresses'] })
queryClient.invalidateQueries({ queryKey: ['main-address'] })
},
onError: (error: Error) => {
console.error('Error updating main address:', error)
Expand Down

0 comments on commit 3d54670

Please sign in to comment.