mdl-identifi-ts
Version:
TypeScript client SDK for the headless micro CRM, Minddale.
37 lines (36 loc) • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.IdentifiClient = void 0;
const minddale_client_1 = require("./minddale.client");
class IdentifiClient extends minddale_client_1.MinddaleClient {
constructor(apiKey, baseUrl) {
super(apiKey, baseUrl);
this.apiKey = apiKey;
this.baseUrl = baseUrl;
}
saveJsonToLocalStorage(key, jsonObject) {
localStorage.setItem(key, JSON.stringify(jsonObject));
}
saveValueToLocalStorage(key, value) {
localStorage.setItem(key, value);
}
getItemFromLocalStorage(key) {
const value = localStorage.getItem(key);
try {
return value ? JSON.parse(value) : null;
}
catch {
return value;
}
}
validateJwtToken(token, endpoint) {
const config = {
headers: {
"Jwt-Token": token
}
};
return this.get(endpoint || IdentifiClient.ENDPOINT, config);
}
}
exports.IdentifiClient = IdentifiClient;
IdentifiClient.ENDPOINT = '/api/open/minddale/v1/identifi/validate-jwt';