Skip to content

Commit

Permalink
Merge pull request #1072 from acm-ucr/menthy/checkin
Browse files Browse the repository at this point in the history
fix checkin
  • Loading branch information
shahdivyank authored Jan 20, 2024
2 parents bf65aa5 + bfba549 commit 70aff62
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/app/api/checkin/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { authenticate } from "@/utils/auth";
export async function GET(req) {
const res = NextResponse;
const { auth, message } = await authenticate({
admins: 1,
admins: [1],
});

if (auth !== 200) {
Expand All @@ -40,7 +40,7 @@ export async function GET(req) {
export async function PUT(req) {
const res = NextResponse;
const { auth, message } = await authenticate({
admins: 1,
admins: [1],
});

if (auth !== 200) {
Expand Down
8 changes: 5 additions & 3 deletions src/components/dynamic/admin/services/checkin/CheckIn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ const CheckIn = () => {
);
});
}, []);

const setResult = async (result) => {
setCode(result);
toast("✅ QR Code Scanned");
if (result !== code) {
setCode(result);
toast("✅ QR Code Scanned");
}
};

const handleCheckIn = async () => {
Expand Down Expand Up @@ -82,6 +83,7 @@ const CheckIn = () => {
/>
)}
<Scanner setResult={setResult} />
<div>{code && code.split("&")[2]}</div>
<Button
text="Check In"
color="green"
Expand Down
4 changes: 3 additions & 1 deletion src/components/dynamic/user/CheckIn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ const CheckinPage = () => {
</div>
<div className="bg-white w-2/3 h-1/3 lg:h-5/6 flex justify-center items-center flex-col rounded-lg m-auto">
<QRCodeSVG
value={`${session.user.id}&${date.toISOString()}`}
value={`${session.user.id}&${date.toISOString()}&${
session.user.name
}`}
className="w-2/3 h-2/3"
/>
</div>
Expand Down

0 comments on commit 70aff62

Please sign in to comment.