diff --git a/client/src/components/task_form.tsx b/client/src/components/task_form.tsx index 868be10..c35a88e 100644 --- a/client/src/components/task_form.tsx +++ b/client/src/components/task_form.tsx @@ -51,6 +51,13 @@ export function TaskForm({ userId, onTaskCreated }: TaskFormProps) { const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); + + const token = localStorage.getItem("access"); + if (!token) { + console.error("No access token"); + return; + } + try { const existing_topic_ids = topics .filter((t) => t.type === "existing") @@ -63,6 +70,7 @@ export function TaskForm({ userId, onTaskCreated }: TaskFormProps) { method: "POST", headers: { "Content-Type": "application/json", + Authorization: `Bearer ${token}`, }, body: JSON.stringify({ name: taskName, diff --git a/client/src/components/task_item.tsx b/client/src/components/task_item.tsx index 50d6079..538fcd0 100644 --- a/client/src/components/task_item.tsx +++ b/client/src/components/task_item.tsx @@ -82,6 +82,9 @@ export function TaskItem({ async function saveEdit() { setSaving(true); + + const token = localStorage.getItem("access"); + try { const existing_topic_ids = draftTopics .filter((t) => t.type === "existing") @@ -98,7 +101,10 @@ export function TaskItem({ `http://localhost:8000/api/planner/tasks/${item.id}/`, { method: "PUT", - headers: { "Content-Type": "application/json" }, + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + }, body: JSON.stringify({ name: draftName, description: draftDescription, diff --git a/client/src/components/timetable.tsx b/client/src/components/timetable.tsx index 27240c4..dd954ab 100644 --- a/client/src/components/timetable.tsx +++ b/client/src/components/timetable.tsx @@ -374,7 +374,7 @@ function Timetable({ timetable_tasks_props }: TimetableProps) { >
focus