chpres: Add debug info for debug starred.

This commit is contained in:
Paulo Gustavo Veiga 2021-03-01 17:40:34 -08:00
parent 0ff867a5d7
commit 9b737d607a
2 changed files with 9 additions and 1 deletions

View File

@ -434,9 +434,11 @@ export default class RestClient implements Client {
}
updateStarred(id: number, starred: boolean): Promise<void> {
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(() => {

View File

@ -338,6 +338,12 @@ export const MapsList = (props: MapsListProps): React.ReactElement => {
const starredMultation = useMutation<void, ErrorInfo, number>(
(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);
},
{