Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async function exec(req, res) {
try {
const graphQLClient = new GraphQLClient(process.env.graphcms_endpoint, {
headers: {
authorization: `Bearer ${process.env.graphcms_pat}`,
},
method: 'POST',
});
const result = await graphQLClient.request(req.body.query, req.body.variables);
return res.status(200).send(result);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
return res.status(502).send('bad request');
}
}
// select distinct(locality), country, location from "Job"
// select
// ST_Distance_Sphere(location::Geometry, ST_MakePoint(48.857091,
// 2.353702)) as distance
// from
// "Job"
// create or replace function search_job_distance(lat float,long float)
// returns table (distance float)
// as
// $body$
// select ST_Distance_Sphere(location::Geometry, ST_MakePoint(lat,
// long)) as distance from "Job"
//
// $body$
// language sql;
const client = new grequest.GraphQLClient(getJobsopts.uri, {
headers: getJobsopts.headers,
});
let jobsAndCompanies = await client
.request(getJobsopts.query, {
ownerId: userId,
userId: userInfo.userId,
meId: meId,
companyId: companyId,
skill: skill,
description: description,
description_fr: description,
remote: remote,
employementType: employementType,
country: country,
locality: locality,
nocompany: query.companies ? null : '_no_company_',
beforeEach(async () => {
const adminParams = {
role: 'admin',
email: 'admin@example.org',
password: '1234',
}
// create an admin user who has enough permissions to create other users
await factory.create('User', adminParams)
const headers = await login(adminParams)
authenticatedClient = new GraphQLClient(host, { headers })
// but also create an unauthenticated client to issue the `User` query
client = new GraphQLClient(host)
})
import { GraphQLClient } from 'graphql-request';
const _TWITCH_CLIENT_ID = "kimne78kx3ncx6brgo4mv6wki5h1ko";
const client = new GraphQLClient('https://gql.twitch.tv/gql', {
headers: {
"Client-ID": _TWITCH_CLIENT_ID
},
})
module.exports = function () {
return {
graphql(query) { return client.request(query); }
}
}
if (rm) {
const acceptApplicationopts = {
uri: getHasuraHost(process, undefined, publicRuntimeConfig),
json: true,
query: updateJobApplicationStatus.loc.source.body,
headers: {
'x-access-token': Cookies.get('token'),
'x-access-role': 'userType',
},
};
let vars = {
id: jobApplication.id,
status: true,
};
const client = new grequest.GraphQLClient(acceptApplicationopts.uri, {
headers: acceptApplicationopts.headers,
});
client.request(acceptApplicationopts.query, vars).then(gdata => {
this.handleUpdateCallback(
this.i18n.t(
'applications:This application has been accepted successfully',
),
);
});
}
};
created: function () {
this.client = new GraphQLClient(this.endpoint, {
credentials: "same-origin",
headers: {
"Authentication-Fallback": true,
"X-CSRF-TOKEN": this.csrf_token
},
});
this.loadData();
},
mounted: function(){
export const makeGithubExplore = (GRAPHQL_ENDPOINT, token) => {
const client = new GraphQLClient(GRAPHQL_ENDPOINT, {
headers: {
authorization: `bearer ${token}`,
},
})
return client
}
return new Promise((res, rej) => {
const client = new GraphQLClient('https://api.dlive.tv/', {
headers: {
authorization: authToken
}
});
const query = `
mutation sendStreamchatMessage($input: SendStreamchatMessageInput!) {
sendStreamchatMessage(input: $input) {
err {
code
message
__typename
}
__typename
}
}
beforeEach(async () => {
const createPostMutation = `
mutation($title: String!, $content: String!) {
CreatePost(title: $title, content: $content) {
id
title
content
}
}
`
authorClient = new GraphQLClient(host, { headers: authorHeaders })
const { CreatePost } = await authorClient.request(createPostMutation, { title, content })
post = CreatePost
})
const useMutation = function(url, query, options = {}) {
const client = new GraphQLClient(url, options)
const [state, dispatch] = useReducer(reducer, {
data: [],
error: null,
loading: false,
})
const makeQuery = async variables => {
dispatch({ type: 'get' })
const resp = await client.request(query, variables)
const data = resp
dispatch({ type: 'success', payload: { data } })
}
return { ...state, makeQuery }
}