Skip to content

Commit

Permalink
add single locker
Browse files Browse the repository at this point in the history
  • Loading branch information
birdpump committed Apr 27, 2024
1 parent 48a3102 commit 427c9bc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/routes/(app)/lookup/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import Show from "./views/show.svelte";
import {fade} from 'svelte/transition';
import {quartOut} from 'svelte/easing';
import {onMount} from "svelte";
import {page} from "$app/stores";
let selected = Lookup;
Expand Down
15 changes: 14 additions & 1 deletion src/routes/(app)/lookup/views/lookup.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
<script>
import { createEventDispatcher } from "svelte";
import {createEventDispatcher, onMount} from "svelte";
import { fetchLocker } from "$lib/services/app/mainApi.js";
import {page} from "$app/stores";
import {goto} from "$app/navigation";
const dispatch = createEventDispatcher();
let input;
let studentID = "";
let id = $page.url.searchParams.get('id');
if(id) {
studentID = id;
submit();
}
async function submit() {
try {
Expand Down Expand Up @@ -33,6 +43,9 @@
submit();
}
}
</script>

<style>
Expand Down
13 changes: 10 additions & 3 deletions src/routes/(app)/register/views/Final.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,28 @@
import {submitLockers} from "$lib/services/app/mainApi.js";
import {singleLocker, studentId1, studentId2, selectedLocation} from "../store.js";
import {goto} from "$app/navigation";
let studentsArr = [];
let buttonMessage = 'Submit';
function next() {
async function next() {
studentsArr[0] = $studentId1;
studentsArr[1] = $studentId2; //todo account for single lockers
if(!$singleLocker) studentsArr[1] = $studentId2;
let finalArr = {
"students": studentsArr,
"location": $selectedLocation,
}
submitLockers(finalArr);
let response = await submitLockers(finalArr);
if(response.ok){
await goto(`/lookup?id=${$studentId1}`);
}else{
//todo show error reason
}
}
</script>
Expand Down

0 comments on commit 427c9bc

Please sign in to comment.