mirror of
https://github.com/thelounge/thelounge
synced 2024-11-10 06:34:21 +00:00
client/ImageViewer: fix types and guard against undefined
This commit is contained in:
parent
03151e0ab1
commit
6241eed8f4
1 changed files with 4 additions and 4 deletions
|
@ -41,9 +41,9 @@
|
|||
<script lang="ts">
|
||||
import Mousetrap from "mousetrap";
|
||||
import {computed, defineComponent, ref, watch} from "vue";
|
||||
import {onBeforeRouteLeave, onBeforeRouteUpdate} from "vue-router";
|
||||
import eventbus from "../js/eventbus";
|
||||
import {ClientChan, ClientMessage, ClientLinkPreview} from "../js/types";
|
||||
import {ClientChan, ClientLinkPreview} from "../js/types";
|
||||
import {SharedMsg} from "../../shared/types/msg";
|
||||
|
||||
export default defineComponent({
|
||||
name: "ImageViewer",
|
||||
|
@ -104,9 +104,9 @@ export default defineComponent({
|
|||
}
|
||||
|
||||
const links = channel.value.messages
|
||||
.map((msg) => msg.previews)
|
||||
.map((msg: SharedMsg) => msg.previews)
|
||||
.flat()
|
||||
.filter((preview) => preview.thumb);
|
||||
.filter((preview) => preview && preview.thumb);
|
||||
|
||||
const currentIndex = links.indexOf(link.value);
|
||||
|
||||
|
|
Loading…
Reference in a new issue