Skip to content

Commit

Permalink
update: use swr mutate on useParticipant hook
Browse files Browse the repository at this point in the history
  • Loading branch information
samderanova committed Jan 26, 2024
1 parent 443bf98 commit 029a30e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/site/src/lib/admin/useParticipants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios from "axios";
import useSWR from "swr";
import useSWR, { mutate } from "swr";

import { Status, Uid } from "@/lib/admin/useApplicant";

Expand Down Expand Up @@ -38,17 +38,20 @@ function useParticipants() {
console.log("Checking in", participant);
// TODO: implement mutation for showing checked in on each day
await axios.post(`/api/admin/checkin/${participant._id}`);
mutate(data);
};

const releaseParticipantFromWaitlist = async (participant: Participant) => {
console.log(`Promoted to waitlist`, participant);
// TODO: implement mutation for showing checked in on each day
await axios.post(`/api/admin/waitlist-release/${participant._id}`);
mutate(data);
};

const confirmNonHacker = async (participant: Participant) => {
console.log("Confirmed attendance for non-hacker", participant);
await axios.post(`/api/admin/update-attendance/${participant._id}`);
mutate(data);
};

return {
Expand Down

0 comments on commit 029a30e

Please sign in to comment.