Skip to content

Commit

Permalink
style: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
slashtechno committed Feb 2, 2025
1 parent 7ab5904 commit 2918c2c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 40 deletions.
1 change: 1 addition & 0 deletions backend/podium/routers/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]):
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/lib/components/AttendEvent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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: "" },
});
Expand All @@ -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
Expand All @@ -38,7 +38,6 @@
goto(url.toString(), { replaceState: true, noScroll: true });
}
});
</script>

<div class="p-4 max-w-md mx-auto">
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/lib/components/JoinProject.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import { afterNavigate, goto } from "$app/navigation";
import { onMount } from "svelte";
let toSend: JoinProjectProjectsJoinPostData = $state({
query: { join_code: "" },
});
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/lib/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}
35 changes: 19 additions & 16 deletions frontend/src/routes/+error.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { page } from '$app/state';
import { on } from 'svelte/events';
import { goto } from "$app/navigation";
import { page } from "$app/state";
import { on } from "svelte/events";
console.log(page);
</script>

<div class="flex my-4 flex-col items-center space-y-4">
{#if page.status ==403 || page.status ==401}
<p>
Authentication required
</p>
<button class="btn btn-primary" onclick={() => {goto(`/login?redirect=${encodeURIComponent(page.url.pathname)}`)}}>
Login / Sign up
</button>
</script>

<div class="flex my-4 flex-col items-center space-y-4">
{#if page.status == 403 || page.status == 401}
<p>Authentication required</p>
<button
class="btn btn-primary"
onclick={() => {
goto(`/login?redirect=${encodeURIComponent(page.url.pathname)}`);
}}
>
Login / Sign up
</button>
{:else}
<h1>Error {page.status ?? 'Unknown error code'}</h1>
<h1>{page.error?.message ?? 'Unknown error message'}</h1>
<h1>Error {page.status ?? "Unknown error code"}</h1>
<h1>{page.error?.message ?? "Unknown error message"}</h1>
{/if}
</div>
</div>
15 changes: 7 additions & 8 deletions frontend/src/routes/events/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -57,11 +55,12 @@
type="checkbox"
class="checkbox"
checked={event.votable}
onchange={(e) => onVotableCheck(
(e.target as HTMLInputElement).checked,
event.id
)}
/></td
onchange={(e) =>
onVotableCheck(
(e.target as HTMLInputElement).checked,
event.id,
)}
/></td
>
</tr>
{/each}
Expand Down
11 changes: 5 additions & 6 deletions frontend/src/routes/login/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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.
Expand Down Expand Up @@ -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}`);
Expand All @@ -84,8 +84,7 @@
}
} catch (error) {
handleError(error);
}
finally {
} finally {
isLoading = false;
}
}
Expand Down Expand Up @@ -143,7 +142,7 @@
if (redirectUrl) {
goto(redirectUrl);
} else {
goto('/');
goto("/");
}
}
} finally {
Expand Down

0 comments on commit 2918c2c

Please sign in to comment.