UNPKG

@chayns-components/core

Version:

A set of beautiful React components for developing your own applications with chayns.

40 lines (39 loc) 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getUserSignature = void 0; var _chaynsApi = require("chayns-api"); var _signature = require("../../constants/signature"); const getUserSignature = async () => { const { accessToken } = await (0, _chaynsApi.getAccessToken)(); if (!accessToken) { return undefined; } try { const response = await fetch(_signature.SIGNATURE_SERVER_URL, { method: 'GET', headers: { accept: 'application/json', authorization: `bearer ${accessToken}` } }); if (response.status === 200) { const { value } = await response.json(); return value; } if (response.status === 204) { return undefined; } console.error('[chayns components] Signature: failed to get user signature', response.status); } catch (ex) { console.error('[chayns components] Signature: failed to get user signature', ex); } return undefined; }; exports.getUserSignature = getUserSignature; //# sourceMappingURL=get.js.map