UNPKG

@chayns-components/core

Version:

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

33 lines 910 B
import { getAccessToken } from 'chayns-api'; import { SIGNATURE_SERVER_URL } from '../../constants/signature'; export const getUserSignature = async () => { const { accessToken } = await getAccessToken(); if (!accessToken) { return undefined; } try { const response = await fetch(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; }; //# sourceMappingURL=get.js.map