mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
Adjust telegram service expected error shape (#484)
Signed-off-by: Ilya Sumbatyants <ilya.sumb@gmail.com>
This commit is contained in:
parent
c60388224b
commit
fa6b390c01
@ -34,7 +34,6 @@
|
||||
"@anticrm/core": "~0.6.11",
|
||||
"svelte": "^3.37.0",
|
||||
"@anticrm/setting": "~0.6.0",
|
||||
"@anticrm/login": "~0.6.1",
|
||||
"@anticrm/ui": "~0.6.0",
|
||||
"@anticrm/presentation": "~0.6.2"
|
||||
}
|
||||
|
@ -13,15 +13,13 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import type { Ref, Space } from '@anticrm/core';
|
||||
import { getMetadata } from '@anticrm/platform';
|
||||
import login from '@anticrm/login'
|
||||
import { getCurrentAccount, Ref, Space } from '@anticrm/core';
|
||||
import { createQuery } from '@anticrm/presentation'
|
||||
import setting from '@anticrm/setting'
|
||||
import type { Integration, IntegrationType } from '@anticrm/setting'
|
||||
import PluginCard from './PluginCard.svelte'
|
||||
|
||||
const accountId = getMetadata(login.metadata.LoginEmail)
|
||||
const accountId = getCurrentAccount()._id
|
||||
const typeQuery = createQuery()
|
||||
const integrationQuery = createQuery()
|
||||
|
||||
@ -29,7 +27,7 @@
|
||||
let integrationTypes: IntegrationType[] = []
|
||||
|
||||
typeQuery.query(setting.class.IntegrationType, {}, (res) => (integrationTypes = res))
|
||||
integrationQuery.query(setting.class.Integration, { space: accountId as Ref<Space> }, (res) => (integrations = res))
|
||||
integrationQuery.query(setting.class.Integration, { space: accountId as string as Ref<Space> }, (res) => (integrations = res))
|
||||
</script>
|
||||
|
||||
<div class="cards-container">
|
||||
|
@ -14,23 +14,22 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Button, Component, Label, Link } from '@anticrm/ui'
|
||||
import { getMetadata, getResource } from '@anticrm/platform'
|
||||
import { getResource } from '@anticrm/platform'
|
||||
import { showPopup } from '@anticrm/ui'
|
||||
import type { Integration, IntegrationType } from '@anticrm/setting'
|
||||
import setting from '@anticrm/setting'
|
||||
import { getClient } from '@anticrm/presentation'
|
||||
import type { Ref, Space } from '@anticrm/core'
|
||||
import login from '@anticrm/login'
|
||||
import { getCurrentAccount, Ref, Space } from '@anticrm/core'
|
||||
|
||||
export let integrationType: IntegrationType
|
||||
export let integration: Integration | undefined
|
||||
const accountId = getMetadata(login.metadata.LoginEmail)
|
||||
const accountId = getCurrentAccount()._id
|
||||
const client = getClient()
|
||||
const onDisconnectP = getResource(integrationType.onDisconnect)
|
||||
|
||||
async function close(res: any): Promise<void> {
|
||||
if (res.value) {
|
||||
await client.createDoc(setting.class.Integration, accountId as Ref<Space>, {
|
||||
if (res?.value) {
|
||||
await client.createDoc(setting.class.Integration, accountId as string as Ref<Space>, {
|
||||
type: integrationType._id,
|
||||
value: res.value
|
||||
})
|
||||
|
@ -65,11 +65,13 @@
|
||||
})
|
||||
const res = await response.json()
|
||||
connecting = false
|
||||
if (res.tg_code === 'PHONE_CODE_INVALID') {
|
||||
error = 'Invalid code'
|
||||
}
|
||||
if (res.err != null) {
|
||||
throw new Error(res.err)
|
||||
|
||||
if (Math.trunc(response.status / 100) !== 2) {
|
||||
if (res.code === 'PHONE_CODE_INVALID') {
|
||||
error = 'Invalid code'
|
||||
}
|
||||
|
||||
throw new Error(res.message)
|
||||
}
|
||||
|
||||
return res
|
||||
|
Loading…
Reference in New Issue
Block a user