mirror of
https://github.com/thelounge/thelounge.git
synced 2024-05-29 11:52:28 +02:00
client/ImageViewer: fix types and guard against undefined
This commit is contained in:
parent
03151e0ab1
commit
6241eed8f4
|
@ -41,9 +41,9 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Mousetrap from "mousetrap";
|
import Mousetrap from "mousetrap";
|
||||||
import {computed, defineComponent, ref, watch} from "vue";
|
import {computed, defineComponent, ref, watch} from "vue";
|
||||||
import {onBeforeRouteLeave, onBeforeRouteUpdate} from "vue-router";
|
|
||||||
import eventbus from "../js/eventbus";
|
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({
|
export default defineComponent({
|
||||||
name: "ImageViewer",
|
name: "ImageViewer",
|
||||||
|
@ -104,9 +104,9 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
const links = channel.value.messages
|
const links = channel.value.messages
|
||||||
.map((msg) => msg.previews)
|
.map((msg: SharedMsg) => msg.previews)
|
||||||
.flat()
|
.flat()
|
||||||
.filter((preview) => preview.thumb);
|
.filter((preview) => preview && preview.thumb);
|
||||||
|
|
||||||
const currentIndex = links.indexOf(link.value);
|
const currentIndex = links.indexOf(link.value);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue