mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 05:31:22 +00:00
Updated login operation
This commit is contained in:
parent
ff2b12bcf1
commit
1086fce6bd
@ -1,5 +1,8 @@
|
||||
import type { ServerResponse } from 'http'
|
||||
import type { OperationContext } from '@commerce/api/operations'
|
||||
import type {
|
||||
OperationContext,
|
||||
OperationOptions,
|
||||
} from '@commerce/api/operations'
|
||||
import type { LoginMutation, LoginMutationVariables } from '../../schema'
|
||||
import type { RecursivePartial } from '../utils/types'
|
||||
import concatHeader from '../utils/concat-cookie'
|
||||
@ -24,12 +27,13 @@ function loginOperation({ commerce }: OperationContext<Provider>) {
|
||||
res: ServerResponse
|
||||
}): Promise<LoginResult>
|
||||
|
||||
async function login<T extends { result?: any }, V = any>(opts: {
|
||||
query: string
|
||||
variables: V
|
||||
res: ServerResponse
|
||||
config?: BigcommerceConfig
|
||||
}): Promise<LoginResult<T>>
|
||||
async function login<T extends { result?: any }, V = any>(
|
||||
opts: {
|
||||
variables: V
|
||||
config?: BigcommerceConfig
|
||||
res: ServerResponse
|
||||
} & OperationOptions
|
||||
): Promise<LoginResult<T>>
|
||||
|
||||
async function login({
|
||||
query = loginMutation,
|
||||
|
@ -24,12 +24,13 @@ export type Operations<P extends APIProvider> = {
|
||||
res: ServerResponse
|
||||
}): Promise<LoginResult>
|
||||
|
||||
<T extends { result?: any }, V = any>(opts: {
|
||||
query: string
|
||||
variables: V
|
||||
res: ServerResponse
|
||||
config?: P['config'] | undefined
|
||||
}): Promise<LoginResult<T>>
|
||||
<T extends { result?: any }, V = any>(
|
||||
opts: {
|
||||
variables: V
|
||||
config?: P['config']
|
||||
res: ServerResponse
|
||||
} & OperationOptions
|
||||
): Promise<LoginResult<T>>
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,3 +49,7 @@ export type AllOperations<P extends APIProvider> = {
|
||||
export type OperationContext<P extends APIProvider> = {
|
||||
commerce: CommerceAPI<P>
|
||||
}
|
||||
|
||||
export type OperationOptions =
|
||||
| { query: string; url?: never }
|
||||
| { query?: never; url: string }
|
||||
|
Loading…
x
Reference in New Issue
Block a user