This commit is contained in:
parent
c775ba8592
commit
700701f055
|
@ -9,18 +9,21 @@ const props = defineProps({
|
|||
const config = reactive({
|
||||
sip: { icon: 'phone', href: `sip:${props.phoneNumber}` },
|
||||
'say-simple': {
|
||||
icon: 'help', // 'whatsapp',
|
||||
icon: 'help', // 'whatsapp icon #6818',
|
||||
href: null,
|
||||
channel: props.channel,
|
||||
},
|
||||
});
|
||||
const type = Object.keys(config).find((key) => key in useAttrs()) || 'sip';
|
||||
|
||||
onBeforeMount(async () => {
|
||||
let url;
|
||||
let channel = props.channel;
|
||||
if (type === 'say-simple')
|
||||
let { channel } = config[type];
|
||||
if (type === 'sip') return;
|
||||
|
||||
if (type === 'say-simple') {
|
||||
url = (await axios.get('SaySimpleConfigs/findOne')).data.url;
|
||||
if (!props.channel)
|
||||
if (!channel)
|
||||
channel = (
|
||||
await axios.get('SaySimpleCountries/findOne', {
|
||||
params: {
|
||||
|
@ -30,8 +33,9 @@ onBeforeMount(async () => {
|
|||
).data?.channel;
|
||||
|
||||
config[
|
||||
'say-simple'
|
||||
type
|
||||
].href = `${url}?customerIdentity=%2B${props.phoneNumber}&channelId=${channel}`;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
|
Loading…
Reference in New Issue