Ocelot-Social/src/jest/helpers.js
Robert Schäfer 5fd44230dd Get rid of LoggedInUser graphql type
This was causing a lot of headache on the frontend. Now, there a single
source of truth. If you query `currentUser` you can overwrite your local
copy of the user and update the UI.
2019-02-27 11:08:13 +01:00

17 lines
438 B
JavaScript

import { request } from 'graphql-request'
// this is the to-be-tested server host
// not to be confused with the seeder host
export const host = 'http://127.0.0.1:4123'
export async function login ({ email, password }) {
const mutation = `
mutation {
login(email:"${email}", password:"${password}")
}`
const response = await request(host, mutation)
return {
authorization: `Bearer ${response.login}`
}
}