36 lines
872 B
TypeScript
36 lines
872 B
TypeScript
import { createApolloClient, getClientWithToken } from '../apollo/client';
|
|
import { env as environment } from '../config/env';
|
|
import * as GQL from '../types';
|
|
|
|
export async function createCustomer(variables: GQL.CreateCustomerMutationVariables) {
|
|
const { mutate } = await getClientWithToken();
|
|
|
|
return mutate({
|
|
mutation: GQL.CreateCustomerDocument,
|
|
variables,
|
|
});
|
|
}
|
|
|
|
export async function getCustomer(variables: GQL.GetCustomerQueryVariables) {
|
|
const { query } = await getClientWithToken();
|
|
|
|
return query({
|
|
query: GQL.GetCustomerDocument,
|
|
variables,
|
|
});
|
|
}
|
|
|
|
export async function login() {
|
|
const { mutate } = createApolloClient();
|
|
|
|
const response = await mutate({
|
|
mutation: GQL.LoginDocument,
|
|
variables: {
|
|
identifier: environment.LOGIN_GRAPHQL,
|
|
password: environment.PASSWORD_GRAPHQL,
|
|
},
|
|
});
|
|
|
|
return response;
|
|
}
|