From 34ed975d79c3acd0b76f538e1aa71b2ca9beb377 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Thu, 13 Jan 2022 17:10:26 -0700 Subject: [PATCH] Fix references to retain --- web/src/api/index.jsx | 4 ++-- web/src/routes/Event.jsx | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/web/src/api/index.jsx b/web/src/api/index.jsx index b5ac78b19..3f5991d35 100644 --- a/web/src/api/index.jsx +++ b/web/src/api/index.jsx @@ -117,10 +117,10 @@ export function useDelete() { return deleteEvent; } -export function useRetain(shouldRetain) { +export function useRetain() { const { dispatch, state } = useContext(Api); - async function retainEvent(eventId) { + async function retainEvent(eventId, shouldRetain) { if (!eventId) return null; const response = await fetch(`${state.host}/api/events/${eventId}?retain=${shouldRetain}`, { method: 'POST' }); diff --git a/web/src/routes/Event.jsx b/web/src/routes/Event.jsx index 1db5351a1..25ae0f083 100644 --- a/web/src/routes/Event.jsx +++ b/web/src/routes/Event.jsx @@ -81,10 +81,12 @@ export default function Event({ eventId, close, scrollRef }) { console.log("handleClickRetain go go go"); let success; try { - success = await setRetainEvent(eventId); + console.log("Trying to send to retain: " + !isRetained) + success = await setRetainEvent(eventId, !isRetained); + console.log("handleClickRetain result: " + success); if (success) { - setIsRetained(!isRetained); + //setIsRetained(!isRetained); } } catch (e) {