@4lch4/toggl-aid
Version:
A wrapper library for interacting with the Toggl API.
27 lines • 878 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseEndpoint = void 0;
const axios_aid_1 = require("@4lch4/axios-aid");
const Defaults_1 = require("../utils/Defaults");
class BaseEndpoint {
constructor(configOpts) {
this.configOpts = configOpts;
this.axios = this.buildAxiosClient();
}
respond(res) {
return res.data ? res.data : res.status;
}
buildAxiosClient() {
return new axios_aid_1.AxiosAid(this.getBaseURL(), Defaults_1.Defaults.headers, {
username: this.configOpts.username,
password: this.configOpts.password
});
}
getBaseURL() {
return this.configOpts.baseUrl
? this.configOpts.baseUrl
: Defaults_1.Defaults.baseTogglUrl;
}
}
exports.BaseEndpoint = BaseEndpoint;
//# sourceMappingURL=BaseEndpoint.js.map