mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 13:41:22 +00:00
Replaced references to commerce.endpoint
This commit is contained in:
parent
9347c1cc21
commit
2353f4b3ed
@ -1,4 +1,5 @@
|
|||||||
import type { GetAPISchema } from '@commerce/api'
|
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
||||||
|
import cartEndpoint from '@commerce/api/endpoints/cart'
|
||||||
import type { CartSchema } from '../../../types/cart'
|
import type { CartSchema } from '../../../types/cart'
|
||||||
import type { BigcommerceAPI } from '../..'
|
import type { BigcommerceAPI } from '../..'
|
||||||
import getCart from './get-cart'
|
import getCart from './get-cart'
|
||||||
@ -10,4 +11,16 @@ export type CartAPI = GetAPISchema<BigcommerceAPI, CartSchema>
|
|||||||
|
|
||||||
export type CartEndpoint = CartAPI['endpoint']
|
export type CartEndpoint = CartAPI['endpoint']
|
||||||
|
|
||||||
export const handlers = { getCart, addItem, updateItem, removeItem }
|
export const handlers: CartEndpoint['handlers'] = {
|
||||||
|
getCart,
|
||||||
|
addItem,
|
||||||
|
updateItem,
|
||||||
|
removeItem,
|
||||||
|
}
|
||||||
|
|
||||||
|
const cartApi = createEndpoint<CartAPI>({
|
||||||
|
handler: cartEndpoint,
|
||||||
|
handlers,
|
||||||
|
})
|
||||||
|
|
||||||
|
export default cartApi
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import type { GetAPISchema } from '@commerce/api'
|
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
||||||
|
import customerEndpoint from '@commerce/api/endpoints/customer'
|
||||||
import type { CustomerSchema } from '../../../types/customer'
|
import type { CustomerSchema } from '../../../types/customer'
|
||||||
import type { BigcommerceAPI } from '../..'
|
import type { BigcommerceAPI } from '../..'
|
||||||
import getLoggedInCustomer from './get-logged-in-customer'
|
import getLoggedInCustomer from './get-logged-in-customer'
|
||||||
@ -7,4 +8,11 @@ export type CustomerAPI = GetAPISchema<BigcommerceAPI, CustomerSchema>
|
|||||||
|
|
||||||
export type CustomerEndpoint = CustomerAPI['endpoint']
|
export type CustomerEndpoint = CustomerAPI['endpoint']
|
||||||
|
|
||||||
export const handlers = { getLoggedInCustomer }
|
export const handlers: CustomerEndpoint['handlers'] = { getLoggedInCustomer }
|
||||||
|
|
||||||
|
const customerApi = createEndpoint<CustomerAPI>({
|
||||||
|
handler: customerEndpoint,
|
||||||
|
handlers,
|
||||||
|
})
|
||||||
|
|
||||||
|
export default customerApi
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import type { GetAPISchema } from '@commerce/api'
|
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
||||||
|
import loginEndpoint from '@commerce/api/endpoints/login'
|
||||||
import type { LoginSchema } from '../../../types/login'
|
import type { LoginSchema } from '../../../types/login'
|
||||||
import type { BigcommerceAPI } from '../..'
|
import type { BigcommerceAPI } from '../..'
|
||||||
import login from './login'
|
import login from './login'
|
||||||
@ -7,4 +8,11 @@ export type LoginAPI = GetAPISchema<BigcommerceAPI, LoginSchema>
|
|||||||
|
|
||||||
export type LoginEndpoint = LoginAPI['endpoint']
|
export type LoginEndpoint = LoginAPI['endpoint']
|
||||||
|
|
||||||
export const handlers = { login }
|
export const handlers: LoginEndpoint['handlers'] = { login }
|
||||||
|
|
||||||
|
const loginApi = createEndpoint<LoginAPI>({
|
||||||
|
handler: loginEndpoint,
|
||||||
|
handlers,
|
||||||
|
})
|
||||||
|
|
||||||
|
export default loginApi
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import type { GetAPISchema } from '@commerce/api'
|
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
||||||
|
import logoutEndpoint from '@commerce/api/endpoints/logout'
|
||||||
import type { LogoutSchema } from '../../../types/logout'
|
import type { LogoutSchema } from '../../../types/logout'
|
||||||
import type { BigcommerceAPI } from '../..'
|
import type { BigcommerceAPI } from '../..'
|
||||||
import logout from './logout'
|
import logout from './logout'
|
||||||
@ -7,4 +8,11 @@ export type LogoutAPI = GetAPISchema<BigcommerceAPI, LogoutSchema>
|
|||||||
|
|
||||||
export type LogoutEndpoint = LogoutAPI['endpoint']
|
export type LogoutEndpoint = LogoutAPI['endpoint']
|
||||||
|
|
||||||
export const handlers = { logout }
|
export const handlers: LogoutEndpoint['handlers'] = { logout }
|
||||||
|
|
||||||
|
const logoutApi = createEndpoint<LogoutAPI>({
|
||||||
|
handler: logoutEndpoint,
|
||||||
|
handlers,
|
||||||
|
})
|
||||||
|
|
||||||
|
export default logoutApi
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import type { GetAPISchema } from '@commerce/api'
|
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
||||||
|
import signupEndpoint from '@commerce/api/endpoints/signup'
|
||||||
import type { SignupSchema } from '../../../types/signup'
|
import type { SignupSchema } from '../../../types/signup'
|
||||||
import type { BigcommerceAPI } from '../..'
|
import type { BigcommerceAPI } from '../..'
|
||||||
import signup from './signup'
|
import signup from './signup'
|
||||||
@ -7,4 +8,11 @@ export type SignupAPI = GetAPISchema<BigcommerceAPI, SignupSchema>
|
|||||||
|
|
||||||
export type SignupEndpoint = SignupAPI['endpoint']
|
export type SignupEndpoint = SignupAPI['endpoint']
|
||||||
|
|
||||||
export const handlers = { signup }
|
export const handlers: SignupEndpoint['handlers'] = { signup }
|
||||||
|
|
||||||
|
const singupApi = createEndpoint<SignupAPI>({
|
||||||
|
handler: signupEndpoint,
|
||||||
|
handlers,
|
||||||
|
})
|
||||||
|
|
||||||
|
export default singupApi
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
||||||
import wishlist from '@commerce/api/endpoints/wishlist'
|
import wishlistEndpoint from '@commerce/api/endpoints/wishlist'
|
||||||
import type { WishlistSchema } from '../../../types/wishlist'
|
import type { WishlistSchema } from '../../../types/wishlist'
|
||||||
import type { BigcommerceAPI } from '../..'
|
import type { BigcommerceAPI } from '../..'
|
||||||
import getWishlist from './get-wishlist'
|
import getWishlist from './get-wishlist'
|
||||||
@ -16,9 +16,9 @@ export const handlers: WishlistEndpoint['handlers'] = {
|
|||||||
removeItem,
|
removeItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
const wishlistEndpoint = createEndpoint({
|
const wishlistApi = createEndpoint<WishlistAPI>({
|
||||||
handler: wishlist as WishlistAPI['endpoint']['handler'],
|
handler: wishlistEndpoint,
|
||||||
handlers,
|
handlers,
|
||||||
})
|
})
|
||||||
|
|
||||||
export default wishlistEndpoint
|
export default wishlistApi
|
||||||
|
@ -4,7 +4,6 @@ import {
|
|||||||
CommerceAPI,
|
CommerceAPI,
|
||||||
CommerceAPIConfig,
|
CommerceAPIConfig,
|
||||||
getCommerceApi as commerceApi,
|
getCommerceApi as commerceApi,
|
||||||
getEndpoint,
|
|
||||||
} from '@commerce/api'
|
} from '@commerce/api'
|
||||||
import fetchGraphqlApi from './utils/fetch-graphql-api'
|
import fetchGraphqlApi from './utils/fetch-graphql-api'
|
||||||
import fetchStoreApi from './utils/fetch-store-api'
|
import fetchStoreApi from './utils/fetch-store-api'
|
||||||
|
@ -5,7 +5,7 @@ import type { GetAPISchema } from '..'
|
|||||||
|
|
||||||
const cartEndpoint: GetAPISchema<
|
const cartEndpoint: GetAPISchema<
|
||||||
any,
|
any,
|
||||||
CartSchema
|
CartSchema<any>
|
||||||
>['endpoint']['handler'] = async (ctx) => {
|
>['endpoint']['handler'] = async (ctx) => {
|
||||||
const { req, res, handlers, config } = ctx
|
const { req, res, handlers, config } = ctx
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import type { GetAPISchema } from '..'
|
|||||||
|
|
||||||
const customerEndpoint: GetAPISchema<
|
const customerEndpoint: GetAPISchema<
|
||||||
any,
|
any,
|
||||||
CustomerSchema
|
CustomerSchema<any>
|
||||||
>['endpoint']['handler'] = async (ctx) => {
|
>['endpoint']['handler'] = async (ctx) => {
|
||||||
const { req, res, handlers } = ctx
|
const { req, res, handlers } = ctx
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import type { GetAPISchema } from '..'
|
|||||||
|
|
||||||
const loginEndpoint: GetAPISchema<
|
const loginEndpoint: GetAPISchema<
|
||||||
any,
|
any,
|
||||||
LoginSchema
|
LoginSchema<any>
|
||||||
>['endpoint']['handler'] = async (ctx) => {
|
>['endpoint']['handler'] = async (ctx) => {
|
||||||
const { req, res, handlers } = ctx
|
const { req, res, handlers } = ctx
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import type { GetAPISchema } from '..'
|
|||||||
|
|
||||||
const wishlistEndpoint: GetAPISchema<
|
const wishlistEndpoint: GetAPISchema<
|
||||||
any,
|
any,
|
||||||
WishlistSchema
|
WishlistSchema<any>
|
||||||
>['endpoint']['handler'] = async (ctx) => {
|
>['endpoint']['handler'] = async (ctx) => {
|
||||||
const { req, res, handlers, config } = ctx
|
const { req, res, handlers, config } = ctx
|
||||||
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
import cart from '@commerce/api/endpoints/cart'
|
import cartApi from '@framework/api/endpoints/cart'
|
||||||
import { CartAPI, handlers } from '@framework/api/endpoints/cart'
|
|
||||||
import commerce from '@lib/api/commerce'
|
import commerce from '@lib/api/commerce'
|
||||||
|
|
||||||
export default commerce.endpoint({
|
export default cartApi(commerce)
|
||||||
handler: cart as CartAPI['endpoint']['handler'],
|
|
||||||
handlers,
|
|
||||||
})
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
import customer from '@commerce/api/endpoints/customer'
|
import customerApi from '@framework/api/endpoints/customer'
|
||||||
import { CustomerAPI, handlers } from '@framework/api/endpoints/customer'
|
|
||||||
import commerce from '@lib/api/commerce'
|
import commerce from '@lib/api/commerce'
|
||||||
|
|
||||||
export default commerce.endpoint({
|
export default customerApi(commerce)
|
||||||
handler: customer as CustomerAPI['endpoint']['handler'],
|
|
||||||
handlers,
|
|
||||||
})
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
import login from '@commerce/api/endpoints/login'
|
import loginApi from '@framework/api/endpoints/login'
|
||||||
import { LoginAPI, handlers } from '@framework/api/endpoints/login'
|
|
||||||
import commerce from '@lib/api/commerce'
|
import commerce from '@lib/api/commerce'
|
||||||
|
|
||||||
export default commerce.endpoint({
|
export default loginApi(commerce)
|
||||||
handler: login as LoginAPI['endpoint']['handler'],
|
|
||||||
handlers,
|
|
||||||
})
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
import logout from '@commerce/api/endpoints/logout'
|
import logoutApi from '@framework/api/endpoints/logout'
|
||||||
import { LogoutAPI, handlers } from '@framework/api/endpoints/logout'
|
|
||||||
import commerce from '@lib/api/commerce'
|
import commerce from '@lib/api/commerce'
|
||||||
|
|
||||||
export default commerce.endpoint({
|
export default logoutApi(commerce)
|
||||||
handler: logout as LogoutAPI['endpoint']['handler'],
|
|
||||||
handlers,
|
|
||||||
})
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
import signup from '@commerce/api/endpoints/signup'
|
import singupApi from '@framework/api/endpoints/signup'
|
||||||
import { SignupAPI, handlers } from '@framework/api/endpoints/signup'
|
|
||||||
import commerce from '@lib/api/commerce'
|
import commerce from '@lib/api/commerce'
|
||||||
|
|
||||||
export default commerce.endpoint({
|
export default singupApi(commerce)
|
||||||
handler: signup as SignupAPI['endpoint']['handler'],
|
|
||||||
handlers,
|
|
||||||
})
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import wishlistEndpoint from '@framework/api/endpoints/wishlist'
|
import wishlistApi from '@framework/api/endpoints/wishlist'
|
||||||
import commerce from '@lib/api/commerce'
|
import commerce from '@lib/api/commerce'
|
||||||
|
|
||||||
export default wishlistEndpoint(commerce)
|
export default wishlistApi(commerce)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user