Skip to content

Commit

Permalink
logout while in organizer view
Browse files Browse the repository at this point in the history
  • Loading branch information
Hetp29 committed Oct 7, 2024
1 parent 37374af commit 1d037d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default function Dashboard() {
data.set('file', waiverFile);
const requiredFields = ["first_name","last_name","resume","github","major","short_answer","shirt_size","hackathon_count","dietary_restrictions","special_needs","age","school","grad_year","gender","level_of_study","country_of_residence","ethnicity","how_you_heard_about_hackru","reasons","phone_number"]
const fieldtext = ["First Name", "Last Name", "Resume", "Github", "major", "What are you hoping to experience at HackRU?", "Shirt Size", "Hackathon Count", "Dietary Restrictions", "Anything we should account for?",
'age', "schhool", "Graduation Year", "Gender", "Level of Study", "Country of Residence", "Ethnicity", "How you heard about hackru", "reasons for attending", "phone number"
'age', "school", "Graduation Year", "Gender", "Level of Study", "Country of Residence", "Ethnicity", "How you heard about hackru", "reasons for attending", "phone number"
]
for (let i = 0; i < requiredFields.length; i++) {
if (!userData[requiredFields[i]]){
Expand Down
17 changes: 17 additions & 0 deletions app/dashboard/views/organizerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import EventScan from './eventScan';
import { AttendEventScan, GetUser, SetUser } from '@/app/lib/actions';
import PopupDialog from '../components/dialog';
import { set } from 'zod';
import Page from '@/app/(pre-dashboard)/(landing)/page';

type STATUS =
| 'SUCCESSFUL'
Expand Down Expand Up @@ -107,6 +108,7 @@ function OrganizerView() {
const [houseOfScannedUser, setHouseOfScannedUser] = useState<string>('');
const [scannedName, setScannedName] = useState<string>('');
const [confirmation, setConfirmation] = useState<boolean>(false);
const [isLoggedIn, setIsLoggedIn] = useState(true);

const resetScanLog = () => {
setScannedName('');
Expand All @@ -115,6 +117,14 @@ function OrganizerView() {
setStatus('AWAITING SCAN');
};

const logout = () => {
setIsLoggedIn(false);
}

if(!isLoggedIn) {
return <Page /> //render page is user is not logged in
}

const handleOnScan = async (
result: string,
forceAttendance: boolean = false,
Expand Down Expand Up @@ -231,6 +241,13 @@ function OrganizerView() {
Event
</button>
</div>

<button
className='mt-2 rounded bg-red-500 px-4 py-2 font-bold text-white hover:bg-red-700'
onClick={logout}
>
Logout
</button>
</div>
{showForceAttendance && (
<PopupDialog
Expand Down

0 comments on commit 1d037d1

Please sign in to comment.