mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 05:31:22 +00:00
Renamed operations to handlers in usage
This commit is contained in:
parent
35c5b1b4a3
commit
066a53d52d
@ -3,7 +3,7 @@ import { parseCartItem } from '../../utils/parse-item'
|
||||
import getCartCookie from '../../utils/get-cart-cookie'
|
||||
import type { CartEndpoint } from '.'
|
||||
|
||||
const addItem: CartEndpoint['operations']['addItem'] = async ({
|
||||
const addItem: CartEndpoint['handlers']['addItem'] = async ({
|
||||
res,
|
||||
body: { cartId, item },
|
||||
config,
|
||||
|
@ -5,7 +5,7 @@ import type { BigcommerceCart } from '../../../types'
|
||||
import type { CartEndpoint } from '.'
|
||||
|
||||
// Return current cart info
|
||||
const getCart: CartEndpoint['operations']['getCart'] = async ({
|
||||
const getCart: CartEndpoint['handlers']['getCart'] = async ({
|
||||
res,
|
||||
body: { cartId },
|
||||
config,
|
||||
|
@ -10,4 +10,4 @@ export type CartAPI = GetAPISchema<BigcommerceAPI, CartSchema>
|
||||
|
||||
export type CartEndpoint = CartAPI['endpoint']
|
||||
|
||||
export const operations = { getCart, addItem, updateItem, removeItem }
|
||||
export const handlers = { getCart, addItem, updateItem, removeItem }
|
||||
|
@ -2,7 +2,7 @@ import { normalizeCart } from '@framework/lib/normalize'
|
||||
import getCartCookie from '../../utils/get-cart-cookie'
|
||||
import type { CartEndpoint } from '.'
|
||||
|
||||
const removeItem: CartEndpoint['operations']['removeItem'] = async ({
|
||||
const removeItem: CartEndpoint['handlers']['removeItem'] = async ({
|
||||
res,
|
||||
body: { cartId, itemId },
|
||||
config,
|
||||
|
@ -3,7 +3,7 @@ import { parseCartItem } from '../../utils/parse-item'
|
||||
import getCartCookie from '../../utils/get-cart-cookie'
|
||||
import type { CartEndpoint } from '.'
|
||||
|
||||
const updateItem: CartEndpoint['operations']['updateItem'] = async ({
|
||||
const updateItem: CartEndpoint['handlers']['updateItem'] = async ({
|
||||
res,
|
||||
body: { cartId, itemId, item },
|
||||
config,
|
||||
|
@ -24,7 +24,7 @@ export const getLoggedInCustomerQuery = /* GraphQL */ `
|
||||
|
||||
export type Customer = NonNullable<GetLoggedInCustomerQuery['customer']>
|
||||
|
||||
const getLoggedInCustomer: CustomerEndpoint['operations']['getLoggedInCustomer'] = async ({
|
||||
const getLoggedInCustomer: CustomerEndpoint['handlers']['getLoggedInCustomer'] = async ({
|
||||
req,
|
||||
res,
|
||||
config,
|
||||
|
@ -7,4 +7,4 @@ export type CustomerAPI = GetAPISchema<BigcommerceAPI, CustomerSchema>
|
||||
|
||||
export type CustomerEndpoint = CustomerAPI['endpoint']
|
||||
|
||||
export const operations = { getLoggedInCustomer }
|
||||
export const handlers = { getLoggedInCustomer }
|
||||
|
@ -7,4 +7,4 @@ export type LoginAPI = GetAPISchema<BigcommerceAPI, LoginSchema>
|
||||
|
||||
export type LoginEndpoint = LoginAPI['endpoint']
|
||||
|
||||
export const operations = { login }
|
||||
export const handlers = { login }
|
||||
|
@ -3,7 +3,7 @@ import type { LoginEndpoint } from '.'
|
||||
|
||||
const invalidCredentials = /invalid credentials/i
|
||||
|
||||
const login: LoginEndpoint['operations']['login'] = async ({
|
||||
const login: LoginEndpoint['handlers']['login'] = async ({
|
||||
res,
|
||||
body: { email, password },
|
||||
config,
|
||||
|
@ -7,4 +7,4 @@ export type LogoutAPI = GetAPISchema<BigcommerceAPI, LogoutSchema>
|
||||
|
||||
export type LogoutEndpoint = LogoutAPI['endpoint']
|
||||
|
||||
export const operations = { logout }
|
||||
export const handlers = { logout }
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { serialize } from 'cookie'
|
||||
import type { LogoutEndpoint } from '.'
|
||||
|
||||
const logout: LogoutEndpoint['operations']['logout'] = async ({
|
||||
const logout: LogoutEndpoint['handlers']['logout'] = async ({
|
||||
res,
|
||||
body: { redirectTo },
|
||||
config,
|
||||
|
@ -7,4 +7,4 @@ export type SignupAPI = GetAPISchema<BigcommerceAPI, SignupSchema>
|
||||
|
||||
export type SignupEndpoint = SignupAPI['endpoint']
|
||||
|
||||
export const operations = { signup }
|
||||
export const handlers = { signup }
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { BigcommerceApiError } from '../../utils/errors'
|
||||
import type { SignupEndpoint } from '.'
|
||||
|
||||
const signup: SignupEndpoint['operations']['signup'] = async ({
|
||||
const signup: SignupEndpoint['handlers']['signup'] = async ({
|
||||
res,
|
||||
body: { firstName, lastName, email, password },
|
||||
config,
|
||||
|
@ -1,8 +1,8 @@
|
||||
import cart from '@commerce/api/endpoints/cart'
|
||||
import { CartAPI, operations } from '@framework/api/endpoints/cart'
|
||||
import { CartAPI, handlers } from '@framework/api/endpoints/cart'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default commerce.endpoint({
|
||||
handler: cart as CartAPI['endpoint']['handler'],
|
||||
operations,
|
||||
handlers,
|
||||
})
|
||||
|
@ -1,8 +1,8 @@
|
||||
import customer from '@commerce/api/endpoints/customer'
|
||||
import { CustomerAPI, operations } from '@framework/api/endpoints/customer'
|
||||
import { CustomerAPI, handlers } from '@framework/api/endpoints/customer'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default commerce.endpoint({
|
||||
handler: customer as CustomerAPI['endpoint']['handler'],
|
||||
operations,
|
||||
handlers,
|
||||
})
|
||||
|
@ -1,8 +1,8 @@
|
||||
import login from '@commerce/api/endpoints/login'
|
||||
import { LoginAPI, operations } from '@framework/api/endpoints/login'
|
||||
import { LoginAPI, handlers } from '@framework/api/endpoints/login'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default commerce.endpoint({
|
||||
handler: login as LoginAPI['endpoint']['handler'],
|
||||
operations,
|
||||
handlers,
|
||||
})
|
||||
|
@ -1,8 +1,8 @@
|
||||
import logout from '@commerce/api/endpoints/logout'
|
||||
import { LogoutAPI, operations } from '@framework/api/endpoints/logout'
|
||||
import { LogoutAPI, handlers } from '@framework/api/endpoints/logout'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default commerce.endpoint({
|
||||
handler: logout as LogoutAPI['endpoint']['handler'],
|
||||
operations,
|
||||
handlers,
|
||||
})
|
||||
|
@ -1,8 +1,8 @@
|
||||
import signup from '@commerce/api/endpoints/signup'
|
||||
import { SignupAPI, operations } from '@framework/api/endpoints/signup'
|
||||
import { SignupAPI, handlers } from '@framework/api/endpoints/signup'
|
||||
import commerce from '@lib/api/commerce'
|
||||
|
||||
export default commerce.endpoint({
|
||||
handler: signup as SignupAPI['endpoint']['handler'],
|
||||
operations,
|
||||
handlers,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user