Properly convert communication API objects

Gets rid of a warning when showing relative time.
This commit is contained in:
Eli Ribble 2026-04-27 19:50:47 +00:00
parent a2b8527d91
commit 63ebe382b6
No known key found for this signature in database
2 changed files with 5 additions and 3 deletions

View file

@ -183,7 +183,7 @@ function selectCommunication(communication: Communication) {
}
// Computed properties
const filteredCommunications = computed(() => {
const filteredCommunications = computed((): Communication[] => {
if (props.all == null) {
return [];
}

View file

@ -1,6 +1,6 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import { Communication } from "@/type/api";
import { Communication, CommunicationDTO } from "@/type/api";
import { SSEManager, SSEMessage } from "@/SSEManager";
import { useSessionStore } from "@/store/session";
@ -38,7 +38,9 @@ export const useCommunicationStore = defineStore("communication", () => {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
all.value = data.communications;
all.value = data.communications.map((c: CommunicationDTO) =>
Communication.fromJSON(c),
);
return data.communications;
} catch (err) {
console.error("Error loading communications:", err);