remove test webhook step
This commit is contained in:
parent
c273a173c9
commit
b3baf4108e
|
@ -11,7 +11,7 @@ interface APIBody {
|
|||
status: 'success' | 'error'
|
||||
}
|
||||
|
||||
const steps = ['get_me', 'get_user_id', 'get_bx', "end_step", "test_webhook"]
|
||||
const steps = ['get_me', 'get_user_id', 'get_bx', "end_step"]
|
||||
|
||||
const { data, pending, error, status } = await useLazyFetch<APIBody>(`${config.public.apiBase}/api/tg/get_me`, { server: false })
|
||||
|
||||
|
@ -60,10 +60,6 @@ const nextStep = async () => {
|
|||
await retryStep('end_step')
|
||||
passToStep('end_step')
|
||||
}
|
||||
else if (step.value == 'end_step') {
|
||||
await retryStep('test_webhook')
|
||||
passToStep('test_webhook')
|
||||
}
|
||||
}
|
||||
const retryStep = async (stepName: typeof steps[number]) => {
|
||||
if (stepName == 'get_user_id') {
|
||||
|
@ -81,9 +77,8 @@ const retryStep = async (stepName: typeof steps[number]) => {
|
|||
}
|
||||
}
|
||||
|
||||
const testWebhook = async () => {
|
||||
const bx_res = await $fetch<APIBody>(`${config.public.apiBase}/api/bx/test_webhook/${selected_tg.value}`)
|
||||
console.log(bx_res)
|
||||
const copyOnClick = (e:Event) => {
|
||||
navigator.clipboard.writeText(e.currentTarget.textContent)
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
@ -104,7 +99,7 @@ const testWebhook = async () => {
|
|||
<li v-for="item in tg_data.slice(0, 1)">
|
||||
Имя: {{ [item.message.chat.first_name, item.message.chat.last_name,
|
||||
item.message.chat.username].filter(Boolean).join(' ') }}<br />
|
||||
ID: <code class="code">{{ item.message.chat.id }}</code>
|
||||
ID: <code class="code" @click="copyOnClick">{{ item.message.chat.id }}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -119,7 +114,7 @@ const testWebhook = async () => {
|
|||
<li :class="isPassed('end_step')" v-if="shown_steps.includes('end_step')">
|
||||
<p>
|
||||
Вот ваша ссылка для формирования вебхука
|
||||
<code>https://gi.svs-tech.pro/integration_tg/{{ selected_bx.id }}/{{ selected_tg }}</code>
|
||||
<code @click="copyOnClick">https://gi.svs-tech.pro/integration_tg/{{ selected_bx.id }}/{{ selected_tg }}</code>
|
||||
</p>
|
||||
<p>
|
||||
Теперь вам осталось <ULink to="https://crm.svs-tech.pro/devops/section/standard/" target="_blank">
|
||||
|
@ -129,20 +124,18 @@ const testWebhook = async () => {
|
|||
Вставьте туда этот урл и укажите События <i>Добавление комментария к задаче (ONTASKCOMMENTADD)</i>
|
||||
</p>
|
||||
</li>
|
||||
<li :class="isPassed('test_webhook')" v-if="shown_steps.includes('test_webhook')">
|
||||
Если вы установили вебхук - можете его проверить!
|
||||
</li>
|
||||
</ol>
|
||||
<template #footer>
|
||||
<div class="flex gap-4">
|
||||
<UButton color="orange" v-if="['get_user_id'].includes(step)" @click="retryStep(step)"
|
||||
:loading="loading" :disabled="disabled">Ошибка в данных
|
||||
</UButton>
|
||||
<UButton @click="testWebhook" v-else-if="step == 'test_webhook'">Проверить</UButton>
|
||||
|
||||
<UButton v-if="step !== 'test_webhook'" :loading="loading" :disabled="disabled || (step == 'get_bx' && !selected_bx)"
|
||||
<UButton v-if="step !== 'end_step'" :loading="loading" :disabled="disabled || (step == 'get_bx' && !selected_bx)"
|
||||
@click="nextStep">
|
||||
Сделано</UButton>
|
||||
|
||||
<p v-if="step=='end_step'">Вот и все!</p>
|
||||
</div>
|
||||
</template>
|
||||
</UCard>
|
||||
|
|
Loading…
Reference in New Issue