added persisting tokenID after password changes on changing session

This commit is contained in:
z1glr
2025-01-11 17:31:18 +00:00
parent b8ede7ef36
commit 4f86dce569
5 changed files with 48 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
import { useEffect, useReducer } from "react";
import { useEffect, useReducer, useState } from "react";
import { Add } from "@carbon/icons-react";
import zustand, { getTasks, Task } from "../../Zustand";
import zustand from "../../Zustand";
import { getLocalTimeZone, now, ZonedDateTime } from "@internationalized/date";
import {
Button,
@@ -16,12 +16,12 @@ import {
Spinner,
Textarea,
} from "@nextui-org/react";
import { apiCall } from "@/lib";
import { apiCall, getTasks, Task } from "@/lib";
interface state {
date: ZonedDateTime;
description: string;
tasks: Task[];
tasks: string[];
}
interface dispatchAction {
@@ -50,11 +50,13 @@ export default function AddEvent(props: {
}
}
const [state, dispatchState] = useReducer(reducer, initialState);
const tasks = zustand((state) => state.tasks);
const [tasks, setTasks] = useState<Record<number, Task>>({});
// get the available tasks
useEffect(() => {
void getTasks();
(async () => {
setTasks(await getTasks());
})();
}, []);
// sends the addEvent request to the backend