20 lines
537 B
JavaScript
20 lines
537 B
JavaScript
import endpoints from './endpoints';
|
|
import request from './request';
|
|
import token from './token';
|
|
|
|
function JSONify(response) {
|
|
return response.json();
|
|
}
|
|
|
|
export function checkToken(possibleToken) {
|
|
const url = endpoints.get('USER_INFO');
|
|
return request(url, 'GET', {}, possibleToken).then(function (response) {
|
|
return response.ok;
|
|
});
|
|
}
|
|
|
|
export async function getProjects() {
|
|
const CIToken = await token.get();
|
|
const url = endpoints.get('ALL_PROJECTS');
|
|
return await request(url, 'GET', {}, CIToken).then(JSONify);
|
|
}
|