mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-08 03:50:21 +00:00
redo of entire app
This commit is contained in:
1 parent
7dee4879a7
commit
093dd7ea9e
45 files changed
+686
-5659
No files matched your search
@@ -0,0 +1,33 @@
|
||||
'use client'; // Mark as a Client Component
|
||||
import { useState } from 'react';
|
||||
import QRScanner from '../../../components/QRScanner';
|
||||
import { useSession } from 'next-auth/react';
|
||||
|
||||
export default function Scan() {
|
||||
const { data: session } = useSession();
|
||||
const [message, setMessage] = useState('');
|
||||
|
||||
const handleScan = async (clueId) => {
|
||||
const response = await fetch('/api/mark-clue', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ clueId, teamId: session.user.teamId }),
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
setMessage('Clue marked as found!');
|
||||
} else {
|
||||
setMessage('Error marking clue.');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Scan QR Code</h1>
|
||||
<QRScanner onScan={handleScan} />
|
||||
{message && <p>{message}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user