UNPKG

gatsby-source-feliks-2

Version:

Gatsby source plugin for building websites using Apricore's Feliks as a data source

26 lines (23 loc) 714 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var axios = require("axios"); var fs = require("fs"); var loadMockingData = exports.loadMockingData = function loadMockingData(mockPath) { var data = fs.readFileSync(mockPath, "utf8"); return JSON.parse(data); }; var fetch = exports.fetch = function fetch(username, password, apiURL) { var now = new Date(); var year = now.getFullYear(); var month = now.getUTCMonth() + 1; var day = now.getUTCDate(); var url = apiURL + "/Courses/from/" + day + "-" + month + "-" + year + "/to/" + day + "-" + month + "-" + (year + 3); return axios(url, { auth: { username: username, password: password } }); };