mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 13:41:22 +00:00
* Changed to query page by id * Fixed page query, Changed use-search GraphQl query * Update use-search.tsx * remove unused util * Changed cookie expiration * Update tsconfig.json * Fix add to cart & prepare for user activation * Update helpers.ts * Update helpers.ts * Changes, fix Shopify GraphQL deprecations * Update checkout-to-cart.ts * Default to BigCommerce * Update index.ts * Fixed types
31 lines
802 B
TypeScript
31 lines
802 B
TypeScript
import { FetcherOptions } from '@commerce/utils/types'
|
|
import throwUserErrors from './throw-user-errors'
|
|
|
|
import {
|
|
MutationCustomerActivateArgs,
|
|
MutationCustomerActivateByUrlArgs,
|
|
} from '../schema'
|
|
import { Mutation } from '../schema'
|
|
import { customerActivateByUrlMutation } from './mutations'
|
|
|
|
const handleAccountActivation = async (
|
|
fetch: <T = any, B = Body>(options: FetcherOptions<B>) => Promise<T>,
|
|
input: MutationCustomerActivateByUrlArgs
|
|
) => {
|
|
try {
|
|
const { customerActivateByUrl } = await fetch<
|
|
Mutation,
|
|
MutationCustomerActivateArgs
|
|
>({
|
|
query: customerActivateByUrlMutation,
|
|
variables: {
|
|
input,
|
|
},
|
|
})
|
|
|
|
throwUserErrors(customerActivateByUrl?.customerUserErrors)
|
|
} catch (error) {}
|
|
}
|
|
|
|
export default handleAccountActivation
|