UNPKG

cluedin-widget

Version:

This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.

33 lines (28 loc) 941 B
import { frontApiRequest } from '../helpers/request'; export const getUserProfile = (id) => ( frontApiRequest('GET', `profileuser/${id}`).then((resp) => { const userProfile = resp.body; if ( userProfile && userProfile.widgetConfiguration && userProfile.widgetConfiguration.length > 0 ) { userProfile.widgetConfiguration.forEach((widgetConfig) => { if (widgetConfig.widgets && widgetConfig.widgets.length > 0) { widgetConfig.widgets.forEach((w) => { if (w.parameters) { try { w.parameters = JSON.parse(w.parameters); } catch (e) { console.log('something went wrong'); } } }); } }); } return userProfile; }) ); export const saveProfile = (id, userProfile) => ( frontApiRequest('POST', `profileuser/${id}`).send(userProfile).then((resp) => (resp.body)) );