mirror of
https://github.com/vercel/commerce.git
synced 2025-06-20 06:01:21 +00:00
* TEC-252: Base integration with commercetools using fetchers for REST and GraphQL endpoints * TEC-252: WIP commenting some components that are failing while we don't have all the hooks defined * add sdk integration * TEC-256: Implementing product search * TEC-256: removing unnecessary env variables * TEC-256: review comments * TEC-256: other remaining review fixes Co-authored-by: nicossosa93 <nicolas.sosa@devgurus.io>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import type { ServerResponse } from 'http'
|
|
import type {
|
|
OperationContext,
|
|
OperationOptions,
|
|
} from '@commerce/api/operations'
|
|
import { Provider, CommercetoolsConfig } from '@framework/api'
|
|
|
|
export default function loginOperation({
|
|
commerce,
|
|
}: OperationContext<Provider>) {
|
|
async function login<T extends { variables: any; data: any }>(opts: {
|
|
variables: T['variables']
|
|
config?: Partial<CommercetoolsConfig>
|
|
res: ServerResponse
|
|
}): Promise<T['data']>
|
|
|
|
async function login<T extends { variables: any; data: any }>(
|
|
opts: {
|
|
variables: T['variables']
|
|
config?: Partial<CommercetoolsConfig>
|
|
res: ServerResponse
|
|
} & OperationOptions
|
|
): Promise<T['data']>
|
|
|
|
async function login<T extends { variables: any; data: any }>({
|
|
query = '',
|
|
variables,
|
|
res: response,
|
|
config: cfg,
|
|
}: {
|
|
query?: string
|
|
variables: T['variables']
|
|
res: ServerResponse
|
|
config?: Partial<CommercetoolsConfig>
|
|
}): Promise<T['data']> {
|
|
const config = commerce.getConfig(cfg)
|
|
return {
|
|
result: '',
|
|
}
|
|
}
|
|
|
|
return login
|
|
}
|