diff --git a/backend/podium/routers/events.py b/backend/podium/routers/events.py index dc9143d..1e8a858 100644 --- a/backend/podium/routers/events.py +++ b/backend/podium/routers/events.py @@ -250,6 +250,7 @@ def make_votable( db.events.update(event_id, {"votable": votable}) + # @router.post("/{event_id}/vote") @router.post("/vote") def vote(vote: Vote, current_user: Annotated[CurrentUser, Depends(get_current_user)]): diff --git a/frontend/src/lib/components/AttendEvent.svelte b/frontend/src/lib/components/AttendEvent.svelte index 8659faf..2e1672b 100644 --- a/frontend/src/lib/components/AttendEvent.svelte +++ b/frontend/src/lib/components/AttendEvent.svelte @@ -4,7 +4,7 @@ import { handleError, invalidateEvents } from "$lib/misc"; import type { AttendEventEventsAttendPostData } from "$lib/client"; import { afterNavigate, goto, invalidate } from "$app/navigation"; - import { onMount } from "svelte"; + import { onMount } from "svelte"; let toSend: AttendEventEventsAttendPostData = $state({ query: { join_code: "", referral: "" }, }); @@ -25,11 +25,11 @@ } } - onMount(() => { + onMount(() => { const urlParams = new URLSearchParams(window.location.search); const join_code = urlParams.get("join_code"); if (join_code) { - toSend.query.join_code = join_code + toSend.query.join_code = join_code; toSend.query.referral = urlParams.get("referral") ?? "Joined from link"; attendEvent(); // Clear the query param @@ -38,7 +38,6 @@ goto(url.toString(), { replaceState: true, noScroll: true }); } }); -
diff --git a/frontend/src/lib/components/JoinProject.svelte b/frontend/src/lib/components/JoinProject.svelte index 9953603..96004f9 100644 --- a/frontend/src/lib/components/JoinProject.svelte +++ b/frontend/src/lib/components/JoinProject.svelte @@ -7,7 +7,6 @@ import { afterNavigate, goto } from "$app/navigation"; import { onMount } from "svelte"; - let toSend: JoinProjectProjectsJoinPostData = $state({ query: { join_code: "" }, }); @@ -27,11 +26,11 @@ } } - onMount(() => { + onMount(() => { const urlParams = new URLSearchParams(window.location.search); const join_code = urlParams.get("join_code"); if (join_code) { - toSend.query.join_code = join_code + toSend.query.join_code = join_code; joinProject(); // Clear the query param const url = new URL(window.location.href); diff --git a/frontend/src/lib/misc.ts b/frontend/src/lib/misc.ts index b0f5ec1..8ece315 100644 --- a/frontend/src/lib/misc.ts +++ b/frontend/src/lib/misc.ts @@ -43,9 +43,9 @@ export function setSystemTheme() { } } -export function invalidateEvents(){ +export function invalidateEvents() { invalidate((url) => url.pathname.startsWith("/events")); } -export function invalidateProjects(){ +export function invalidateProjects() { invalidate((url) => url.pathname.startsWith("/projects")); -} \ No newline at end of file +} diff --git a/frontend/src/routes/+error.svelte b/frontend/src/routes/+error.svelte index 68c0063..b4271ce 100644 --- a/frontend/src/routes/+error.svelte +++ b/frontend/src/routes/+error.svelte @@ -1,20 +1,23 @@ - -
- {#if page.status ==403 || page.status ==401} -

- Authentication required -

- + + +
+ {#if page.status == 403 || page.status == 401} +

Authentication required

+ {:else} -

Error {page.status ?? 'Unknown error code'}

-

{page.error?.message ?? 'Unknown error message'}

+

Error {page.status ?? "Unknown error code"}

+

{page.error?.message ?? "Unknown error message"}

{/if} -
\ No newline at end of file +
diff --git a/frontend/src/routes/events/+page.svelte b/frontend/src/routes/events/+page.svelte index 2a56cd3..e8d9400 100644 --- a/frontend/src/routes/events/+page.svelte +++ b/frontend/src/routes/events/+page.svelte @@ -13,9 +13,7 @@ try { console.log(value, eventId); await EventsService.makeVotableEventsMakeVotablePost({ - query: { votable: value, - event_id: eventId - }, + query: { votable: value, event_id: eventId }, throwOnError: true, }); } catch (err) { @@ -57,11 +55,12 @@ type="checkbox" class="checkbox" checked={event.votable} - onchange={(e) => onVotableCheck( - (e.target as HTMLInputElement).checked, - event.id - )} - /> + onVotableCheck( + (e.target as HTMLInputElement).checked, + event.id, + )} + /> {/each} diff --git a/frontend/src/routes/login/+page.svelte b/frontend/src/routes/login/+page.svelte index 587e166..347ea7d 100644 --- a/frontend/src/routes/login/+page.svelte +++ b/frontend/src/routes/login/+page.svelte @@ -4,7 +4,7 @@ import { onMount } from "svelte"; import { user, validateToken } from "$lib/user.svelte"; import { AuthService, UsersService } from "$lib/client/sdk.gen"; - import { goto } from '$app/navigation'; + import { goto } from "$app/navigation"; import type { HTTPValidationError } from "$lib/client/types.gen"; import { handleError } from "$lib/misc"; import type { UserSignupPayload } from "$lib/client/types.gen"; @@ -28,7 +28,7 @@ dob: "", }); - let redirectUrl: string + let redirectUrl: string; async function eitherLoginOrSignUp() { // If showSignupFields is true, the user is signing up and signupAndLogin should be called. Otherwise, the user is logging in and login should be called. @@ -71,7 +71,7 @@ // Request magic link for the provided email if the user exists await AuthService.requestLoginRequestLoginPost({ body: { email: userInfo.email }, - query: { redirect: redirectUrl ?? ""}, + query: { redirect: redirectUrl ?? "" }, throwOnError: true, }); toast(`Magic link sent to ${userInfo.email}`); @@ -84,8 +84,7 @@ } } catch (error) { handleError(error); - } - finally { + } finally { isLoading = false; } } @@ -143,7 +142,7 @@ if (redirectUrl) { goto(redirectUrl); } else { - goto('/'); + goto("/"); } } } finally {