들어가기
client에서 query 실행시 받아오는
data들을 깔끜하게 정리해 놓은 것이
fragment
import { gql } from '@apollo/client'
export const RESTAURANT_FRAGMENT = gql`
fragment RestaurantParts on Restaurant {
id
name
coverImg
category {
name
}
address
}
`
export const CATEGORY_FRAGMENT = gql`
fragment CategoryParts on Category {
id
name
coverImg
slug
restaurantCount
}
`
export const DISH_FRAGMENT = gql`
fragment DishParts on Dish {
id
name
price
photo
description
options {
name
extra
choices {
name
extra
}
}
}
`
export const ORDERS_FRAGMENT = gql`
fragment OrderParts on Order {
id
createdAt
total
}
`
export const FULL_ORDER_FRAGMENT = gql`
fragment FullOrderParts on Order {
id
status
total
driver {
email
}
customer {
email
}
restaurant {
name
}
}
`;
참고만 하고 실제 사용되는 코딩은 위의 restaurants.tsx에
잘 나와있음.