From ae8c7f894aefca277ca82de8d1c7bebd87d25863 Mon Sep 17 00:00:00 2001 From: ingalls Date: Tue, 15 Oct 2024 14:58:44 -0600 Subject: [PATCH] Delete Video Lease --- .../src/components/CloudTAK/util/Video.vue | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/api/web/src/components/CloudTAK/util/Video.vue b/api/web/src/components/CloudTAK/util/Video.vue index 4cf3f3cea..690b1238f 100644 --- a/api/web/src/components/CloudTAK/util/Video.vue +++ b/api/web/src/components/CloudTAK/util/Video.vue @@ -80,10 +80,12 @@ export default defineComponent({ loading: true } }, - unmounted: function() { + unmounted: async function() { if (this.player) { this.player.dispose(); } + + await this.deleteLease(); }, mounted: async function() { await this.requestLease(); @@ -95,7 +97,21 @@ export default defineComponent({ } }, methods: { - requestLease: async function() { + deleteLease: async function(): Promise { + if (!this.lease) return; + + try { + await std(`/api/video/lease/${this.lease.id}`, { + method: 'DELETE', + }); + + this.loading = false; + } catch (err) { + this.loading = false; + this.err = err instanceof Error ? err : new Error(String(err)); + } + }, + requestLease: async function(): Promise { try { const { lease, protocols } = await std('/api/video/lease', { method: 'POST',