Fix the ability to mark communications signal/noise
This commit is contained in:
parent
978c20d72a
commit
22c2df11f8
2 changed files with 8 additions and 9 deletions
|
|
@ -1,10 +1,11 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref, computed } from "vue";
|
||||
import { useUserStore } from "./user";
|
||||
import { Communication } from "../types";
|
||||
|
||||
export const useCommunicationStore = defineStore("communication", () => {
|
||||
// State
|
||||
const all = ref(null);
|
||||
const all = ref<Communication[] | null>(null);
|
||||
const loading = ref(false);
|
||||
const error = ref(null);
|
||||
|
||||
|
|
|
|||
|
|
@ -887,17 +887,15 @@ async function markInvalid() {
|
|||
}
|
||||
|
||||
function removeCurrentFromList() {
|
||||
const index = communications.value.findIndex(
|
||||
(c) => c.id === selectedCommunication.value.id,
|
||||
);
|
||||
const index = communication.all.findIndex((c) => c.id === selectedId.value);
|
||||
if (index > -1) {
|
||||
communications.value.splice(index, 1);
|
||||
communication.all.splice(index, 1);
|
||||
}
|
||||
if (communications.value.length > 0) {
|
||||
const nextIndex = Math.min(index, communications.value.length - 1);
|
||||
selectedCommunication.value = communications.value[nextIndex];
|
||||
if (communication.all.length > 0) {
|
||||
const nextIndex = Math.min(index, communication.all.length - 1);
|
||||
selectedId.value = communication.all[nextIndex].id;
|
||||
} else {
|
||||
selectedCommunication.value = null;
|
||||
selectedId.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue