From 9b737d607a45585ebe4adff74a87ecd0537f1fcd Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 1 Mar 2021 17:40:34 -0800 Subject: [PATCH] chpres: Add debug info for debug starred. --- packages/webapp/src/classes/client/rest-client/index.ts | 4 +++- .../webapp/src/components/maps-page/maps-list/index.tsx | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/webapp/src/classes/client/rest-client/index.ts b/packages/webapp/src/classes/client/rest-client/index.ts index 4c324fca..87f8dcc5 100644 --- a/packages/webapp/src/classes/client/rest-client/index.ts +++ b/packages/webapp/src/classes/client/rest-client/index.ts @@ -434,9 +434,11 @@ export default class RestClient implements Client { } updateStarred(id: number, starred: boolean): Promise { + + console.debug(`Starred ${starred}`) const handler = (success: () => void, reject: (error: ErrorInfo) => void) => { axios - .put(`${this.baseUrl}/c/restful/maps/${id}/starred`, Boolean(starred), { + .put(`${this.baseUrl}/c/restful/maps/${id}/starred`, starred, { headers: { 'Content-Type': 'text/plain' }, }) .then(() => { diff --git a/packages/webapp/src/components/maps-page/maps-list/index.tsx b/packages/webapp/src/components/maps-page/maps-list/index.tsx index be62e0df..3bf1526f 100644 --- a/packages/webapp/src/components/maps-page/maps-list/index.tsx +++ b/packages/webapp/src/components/maps-page/maps-list/index.tsx @@ -338,6 +338,12 @@ export const MapsList = (props: MapsListProps): React.ReactElement => { const starredMultation = useMutation( (id: number) => { const map = mapsInfo.find((m) => m.id == id); + if(!map){ + console.error(`Map ${id} could not be found.`); + console.error(`MapsInfo ${mapsInfo} list`); + } + console.debug(`Starred value map?.starred: ${map?.starred}`); + return client.updateStarred(id, !map?.starred); }, {