diff --git a/.changeset/lovely-dolphins-tickle.md b/.changeset/lovely-dolphins-tickle.md
new file mode 100644
index 0000000..3e1bc2f
--- /dev/null
+++ b/.changeset/lovely-dolphins-tickle.md
@@ -0,0 +1,5 @@
+---
+"@quassel/frontend": patch
+---
+
+Disable delete for assistants
diff --git a/apps/frontend/src/routes/_auth/administration/carers/index.tsx b/apps/frontend/src/routes/_auth/administration/carers/index.tsx
index d9deac9..5aa3f4d 100644
--- a/apps/frontend/src/routes/_auth/administration/carers/index.tsx
+++ b/apps/frontend/src/routes/_auth/administration/carers/index.tsx
@@ -1,8 +1,11 @@
import { createFileRoute, Link } from "@tanstack/react-router";
import { $api } from "../../../../stores/api";
import { Button, Table } from "@quassel/ui";
+import { $session } from "../../../../stores/session";
+import { useStore } from "@nanostores/react";
function AdministrationCarersIndex() {
+ const sessionStore = useStore($session);
const carers = $api.useSuspenseQuery("get", "/carers");
const deleteCarerMutation = $api.useMutation("delete", "/carers/{id}", {
onSuccess: () => carers.refetch(),
@@ -29,16 +32,18 @@ function AdministrationCarersIndex() {
-
+ {sessionStore.role === "ADMIN" && (
+
+ )}
))}
diff --git a/apps/frontend/src/routes/_auth/administration/languages/index.tsx b/apps/frontend/src/routes/_auth/administration/languages/index.tsx
index 229eb3e..2d01953 100644
--- a/apps/frontend/src/routes/_auth/administration/languages/index.tsx
+++ b/apps/frontend/src/routes/_auth/administration/languages/index.tsx
@@ -2,8 +2,11 @@ import { createFileRoute, Link } from "@tanstack/react-router";
import { $api } from "../../../../stores/api";
import { Button, Table } from "@quassel/ui";
import { useSuspenseQuery } from "@tanstack/react-query";
+import { $session } from "../../../../stores/session";
+import { useStore } from "@nanostores/react";
function AdministrationLanguageIndex() {
+ const sessionStore = useStore($session);
const languages = useSuspenseQuery($api.queryOptions("get", "/languages"));
const deleteLanguageMutation = $api.useMutation("delete", "/languages/{id}", {
onSuccess: () => languages.refetch(),
@@ -32,16 +35,18 @@ function AdministrationLanguageIndex() {
-
+ {sessionStore.role === "ADMIN" && (
+
+ )}
))}
diff --git a/apps/frontend/src/routes/_auth/administration/participants/index.tsx b/apps/frontend/src/routes/_auth/administration/participants/index.tsx
index 8b56385..77adfe1 100644
--- a/apps/frontend/src/routes/_auth/administration/participants/index.tsx
+++ b/apps/frontend/src/routes/_auth/administration/participants/index.tsx
@@ -2,8 +2,11 @@ import { createFileRoute, Link } from "@tanstack/react-router";
import { $api } from "../../../../stores/api";
import { Button, Table } from "@quassel/ui";
import { useSuspenseQuery } from "@tanstack/react-query";
+import { $session } from "../../../../stores/session";
+import { useStore } from "@nanostores/react";
function AdministrationParticipantsIndex() {
+ const sessionStore = useStore($session);
const participants = useSuspenseQuery($api.queryOptions("get", "/participants"));
const deleteParticipantMutation = $api.useMutation("delete", "/participants/{id}", {
onSuccess: () => participants.refetch(),
@@ -34,16 +37,18 @@ function AdministrationParticipantsIndex() {
-
+ {sessionStore.role === "ADMIN" && (
+
+ )}
))}
diff --git a/apps/frontend/src/routes/_auth/administration/questionnaires/index.tsx b/apps/frontend/src/routes/_auth/administration/questionnaires/index.tsx
index 1614d56..d19ed77 100644
--- a/apps/frontend/src/routes/_auth/administration/questionnaires/index.tsx
+++ b/apps/frontend/src/routes/_auth/administration/questionnaires/index.tsx
@@ -1,8 +1,11 @@
import { createFileRoute, Link } from "@tanstack/react-router";
import { $api } from "../../../../stores/api";
import { Button, Table } from "@quassel/ui";
+import { $session } from "../../../../stores/session";
+import { useStore } from "@nanostores/react";
function AdministrationQuestionnairesIndex() {
+ const sessionStore = useStore($session);
const { data, refetch } = $api.useSuspenseQuery("get", "/questionnaires");
const deleteQuestionnaireMutation = $api.useMutation("delete", "/questionnaires/{id}", {
onSuccess: () => refetch(),
@@ -25,16 +28,18 @@ function AdministrationQuestionnairesIndex() {
-
+ {sessionStore.role === "ADMIN" && (
+
+ )}
))}
diff --git a/apps/frontend/src/routes/_auth/administration/studies/index.tsx b/apps/frontend/src/routes/_auth/administration/studies/index.tsx
index cca42b0..c68b83b 100644
--- a/apps/frontend/src/routes/_auth/administration/studies/index.tsx
+++ b/apps/frontend/src/routes/_auth/administration/studies/index.tsx
@@ -2,8 +2,11 @@ import { createFileRoute, Link } from "@tanstack/react-router";
import { $api } from "../../../../stores/api";
import { Button, Table } from "@quassel/ui";
import { useSuspenseQuery } from "@tanstack/react-query";
+import { $session } from "../../../../stores/session";
+import { useStore } from "@nanostores/react";
function AdministrationStudiesIndex() {
+ const sessionStore = useStore($session);
const studies = useSuspenseQuery($api.queryOptions("get", "/studies"));
const deleteStudyMutation = $api.useMutation("delete", "/studies/{id}", {
onSuccess: () => studies.refetch(),
@@ -30,16 +33,18 @@ function AdministrationStudiesIndex() {
-
+ {sessionStore.role === "ADMIN" && (
+
+ )}
))}
diff --git a/apps/frontend/src/routes/_auth/administration/users/index.tsx b/apps/frontend/src/routes/_auth/administration/users/index.tsx
index 611df89..1f702b2 100644
--- a/apps/frontend/src/routes/_auth/administration/users/index.tsx
+++ b/apps/frontend/src/routes/_auth/administration/users/index.tsx
@@ -2,8 +2,11 @@ import { createFileRoute, Link } from "@tanstack/react-router";
import { $api } from "../../../../stores/api";
import { Button, Table } from "@quassel/ui";
import { useSuspenseQuery } from "@tanstack/react-query";
+import { useStore } from "@nanostores/react";
+import { $session } from "../../../../stores/session";
function AdministrationUsersIndex() {
+ const sessionStore = useStore($session);
const users = useSuspenseQuery($api.queryOptions("get", "/users"));
const deleteUserMutation = $api.useMutation("delete", "/users/{id}", { onSuccess: () => users.refetch() });
@@ -31,9 +34,11 @@ function AdministrationUsersIndex() {
-
+ {sessionStore.role === "ADMIN" && (
+
+ )}
))}
diff --git a/apps/frontend/src/stores/session.ts b/apps/frontend/src/stores/session.ts
index 9cdc67a..2805e1f 100644
--- a/apps/frontend/src/stores/session.ts
+++ b/apps/frontend/src/stores/session.ts
@@ -1,8 +1,6 @@
import { persistentMap } from "@nanostores/persistent";
+import { components } from "../api.gen";
-type Session = {
- email?: string;
- role?: string;
-};
+type Session = Partial>;
-export const $session = persistentMap("session:", {});
+export const $session = persistentMap("session", {});