UNPKG

open-sesame-js-client

Version:
37 lines (34 loc) 774 B
// open-sesame-js-client-sdk // v0.0.1 export function openSesame(apiKey, user){ // set user call + api auth // fetch flags call fetchFlags(apiKey, user); } function fetchFlags(apiKey, user){ fetch('http://localhost:3000/api/feature_users', { method: 'POST', body: user, headers: { 'Content-Type': 'application/json', 'Project-Key': apiKey }, }) .then(function (response) { if (response.ok) { return response.json(); } else { return Promise.reject({ status: response.status, statusText: response.statusText }); } }) .then(function (data) { console.log('success', data); }) .catch(function (error) { console.log('error', error); }); } export default { openSesame };