Refactor /me routes

This commit is contained in:
Dominic Ferrando
2026-09-26 16:07:21 -04:00
parent d2c31ba9fa
commit 0d9b8fb4fa
2 changed files with 87 additions and 94 deletions
@@ -18,7 +18,7 @@
import { api } from "$lib/api";
type AssessmentRow = NonNullable<
Awaited<ReturnType<typeof api.assessments.me.get>>["data"]
Awaited<ReturnType<typeof api.accounts.me.assessments.get>>["data"]
>[number];
interface CalcData {
@@ -112,7 +112,7 @@
loading = true;
loadError = null;
try {
const res = await api.assessments.me.get();
const res = await api.accounts.me.assessments.get();
if (res.error) throw res.error;
calculations = (res.data ?? []).map(assessmentToCalc);
} catch (err) {
@@ -135,7 +135,7 @@
});
if (res.error) throw res.error;
} else {
const res = await api.assessments.me.post({
const res = await api.accounts.me.assessments.post({
player: calculation.player,
activityPerformances: calculation.activityPerformances,
});
@@ -162,7 +162,7 @@
calculation.deleting = true;
calculation.deleteError = undefined;
try {
const res = await api.assessments.me({ id: calculation.id }).delete();
const res = await api.accounts.me.assessments({ id: calculation.id }).delete();
if (res.error) throw res.error;
calculations.splice(index, 1);
} catch (err) {