Fix references to retain

This commit is contained in:
Nick Mowen 2022-01-13 17:10:26 -07:00
parent 322677e1e0
commit 34ed975d79
2 changed files with 6 additions and 4 deletions

View File

@ -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' });

View File

@ -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) {