-
Notifications
You must be signed in to change notification settings - Fork 453
/
Copy pathCallFailedDialog.vue
71 lines (58 loc) · 1.8 KB
/
CallFailedDialog.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!--
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<script setup lang="ts">
import { computed } from 'vue'
import IconAlertOctagon from 'vue-material-design-icons/AlertOctagon.vue'
import { t } from '@nextcloud/l10n'
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import { useStore } from '../../composables/useStore.js'
import { messagePleaseTryToReload } from '../../utils/talkDesktopUtils.ts'
const store = useStore()
const props = defineProps({
token: {
type: String,
required: true,
},
})
const STATUS_ERRORS = {
400: t('spreed', 'Recording consent is required'),
403: t('spreed', 'This conversation is read-only'),
404: t('spreed', 'Conversation not found or not joined'),
412: t('spreed', "Lobby is still active and you're not a moderator"),
}
const connectionFailed = computed(() => store.getters.connectionFailed(props.token))
const connectionFailedDialogId = `connection-failed-${props.token}`
const message = computed(() => {
if (!connectionFailed.value) {
return ''
}
const statusCode = connectionFailed.value?.meta?.statuscode
if (STATUS_ERRORS[statusCode]) {
return STATUS_ERRORS[statusCode]
}
if (connectionFailed.value?.data?.error) {
return connectionFailed.value.data.error
}
return messagePleaseTryToReload
})
/**
*
*/
function clearConnectionFailedError() {
store.dispatch('clearConnectionFailed', props.token)
}
</script>
<template>
<NcModal :label-id="connectionFailedDialogId"
@close="clearConnectionFailedError">
<NcEmptyContent :name="t('spreed', 'Connection failed')"
:description="message">
<template #icon>
<IconAlertOctagon />
</template>
</NcEmptyContent>
</NcModal>
</template>