Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {
type AlertReceiverCreationRequest,
type AlertReceiverEditRequest,
type AlertReceiverResponse,
type AlertReceiverType,
type SlackAlertReceiverCreationRequest,
Expand Down Expand Up @@ -76,25 +78,27 @@ export function NotificationChannelModal({
const webhookUrlValue = webhook_url === FAKE_PLACEHOLDER ? undefined : webhook_url
const editPayload: SlackAlertReceiverEditRequest = {
...restData,
type: 'SLACK',
description: alertReceiver.description ?? 'Webhook for Qovery alerts',
...(webhookUrlValue && webhookUrlValue.trim() !== '' ? { webhook_url: webhookUrlValue } : {}),
}

try {
await editAlertReceiver({ alertReceiverId: alertReceiver.id, payload: editPayload })
await editAlertReceiver({ alertReceiverId: alertReceiver.id, payload: editPayload as AlertReceiverEditRequest })
onClose()
} catch (error) {
console.error(error)
}
} else {
const createRequest: SlackAlertReceiverCreationRequest = {
...data,
type: 'SLACK',
description: 'Webhook for Qovery alerts',
organization_id: organizationId,
}

try {
await createAlertReceiver({ payload: createRequest })
await createAlertReceiver({ payload: createRequest as AlertReceiverCreationRequest })
onClose()
} catch (error) {
console.error(error)
Expand All @@ -115,13 +119,14 @@ export function NotificationChannelModal({
const formData = methods.getValues()
const alertReceiverPayload: SlackAlertReceiverCreationRequest = {
...formData,
type: 'SLACK',
organization_id: organizationId,
description: 'Webhook for Qovery alerts',
webhook_url: webhookUrl,
webhook_url: webhookUrl ?? '',
}
validateAlertReceiver({
payload: {
alert_receiver: alertReceiverPayload,
alert_receiver: alertReceiverPayload as AlertReceiverCreationRequest,
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"mermaid": "^11.6.0",
"monaco-editor": "0.53.0",
"posthog-js": "^1.260.1",
"qovery-typescript-axios": "^1.1.810",
"qovery-typescript-axios": "^1.1.812",
"react": "18.3.1",
"react-country-flag": "^3.0.2",
"react-datepicker": "^4.12.0",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5679,7 +5679,7 @@ __metadata:
prettier: ^3.2.5
prettier-plugin-tailwindcss: ^0.5.14
pretty-quick: ^4.0.0
qovery-typescript-axios: ^1.1.810
qovery-typescript-axios: ^1.1.812
qovery-ws-typescript-axios: ^0.1.420
react: 18.3.1
react-country-flag: ^3.0.2
Expand Down Expand Up @@ -24520,12 +24520,12 @@ __metadata:
languageName: node
linkType: hard

"qovery-typescript-axios@npm:^1.1.810":
version: 1.1.810
resolution: "qovery-typescript-axios@npm:1.1.810"
"qovery-typescript-axios@npm:^1.1.812":
version: 1.1.812
resolution: "qovery-typescript-axios@npm:1.1.812"
dependencies:
axios: 1.12.2
checksum: ede17ba36ba149256f91eab4420f9954fa43619b9029ce91864100dcbae1a0f6926187564edb8a386ee14e22f9fd5e352c42c0565e0d5708cd1a475af0c96f5e
checksum: f682cdeb07aa02164c9ee75a1ef8c914a0584e5fc1a3265c65a7583976af7b16d4a13e485e1e29f946ed1e9033aa378f152636a21793326773503bb2eb882714
languageName: node
linkType: hard

Expand Down
Loading