UNPKG

@chayns-components/core

Version:

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

38 lines (37 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.putUserSignature = void 0; var _chaynsApi = require("chayns-api"); var _signature = require("../../constants/signature"); const putUserSignature = async dataURL => { const { accessToken } = await (0, _chaynsApi.getAccessToken)(); if (!accessToken) { return false; } try { const response = await fetch(_signature.SIGNATURE_SERVER_URL, { method: 'PUT', headers: { accept: 'application/json', authorization: `bearer ${accessToken}`, 'content-type': 'application/json' }, body: JSON.stringify({ value: dataURL }) }); if (response.ok) { return true; } console.error('[chayns components] Signature: failed to put user signature', response.status); } catch (ex) { console.error('[chayns components] Signature: failed to put user signature', ex); } return false; }; exports.putUserSignature = putUserSignature; //# sourceMappingURL=put.js.map