saleor-dashboard/src/webhooks/mutations.ts

65 lines
1.6 KiB
TypeScript
Raw Normal View History

import { webhookErrorFragment } from "@saleor/fragments/errors";
import { webhooksDetailsFragment } from "@saleor/fragments/webhooks";
Apps (#599) * create Apps view * create more app components, generate types and messages * apps refactor, update snapshots * show error message in tooltip when app installation fail * update apps components and view, add apps list to storybook * update defaultMessages * create app details view * update AppListPage with Skeleton component * create app activate/deactivate dialogs, create app details stories * add AppHeader to AppDetailsPage * update defaultMessages * update AppDetails view and components after review * create custom app details view * refactor webhooks * update webhooks fixtures * update WebhookDetailsPage story * update strings * create CustomAppCreate view and components * update AppListPage story * create AppInstall view and page * handle errors in AppInstall view * update defaultMessages * add AppInstallPage to storybook * add status prop to MessageManager * update defaultMessages * remove service account section * remove service account routes * remove as operator from notify status * add notifications for app installations * update styles for deactivated app * update app installations with local storage * update defaultMessages * AppInstall update * dd delete button to ongoin installations table * fix active installations condition * fix error messages in AppsList * update defaultMessages * add iframe to AppDetailsPage * create AppDetailsSettingsPage * install macaw-ui * apps styles clean up * update schema, fixtures * few apps updates * WebhookCreate - fix onBack button name * WebhookCreatePage story update * rename apps table from external to thirdparty * update defaultMessages * fix test, update snapshots * AppDetailsSettings - add token to headers * fix first number in local apps query * app details settings - use shop domain host * add onSettingsRowClick to InstalledApps * resolve conflicts * update changelog and messages * add noopener noreferrer do app privacy link * update snapshots * update snapshots * updates after review * update defaultMessages * CustomAppDetails - add missing notify status
2020-07-22 10:54:15 +00:00
import makeMutation from "@saleor/hooks/makeMutation";
2019-10-09 06:01:52 +00:00
import gql from "graphql-tag";
import { WebhookCreate, WebhookCreateVariables } from "./types/WebhookCreate";
import { WebhookDelete, WebhookDeleteVariables } from "./types/WebhookDelete";
import { WebhookUpdate, WebhookUpdateVariables } from "./types/WebhookUpdate";
const webhookCreate = gql`
${webhooksDetailsFragment}
2020-03-18 11:03:20 +00:00
${webhookErrorFragment}
2019-10-09 06:01:52 +00:00
mutation WebhookCreate($input: WebhookCreateInput!) {
2019-10-09 06:56:46 +00:00
webhookCreate(input: $input) {
errors {
2020-03-18 11:03:20 +00:00
...WebhookErrorFragment
2019-10-18 12:01:26 +00:00
}
2019-10-09 06:01:52 +00:00
webhook {
...WebhooksDetailsFragment
}
}
}
`;
const webhookUpdate = gql`
${webhooksDetailsFragment}
2020-03-18 11:03:20 +00:00
${webhookErrorFragment}
2019-10-09 06:01:52 +00:00
mutation WebhookUpdate($id: ID!, $input: WebhookUpdateInput!) {
2019-10-09 06:56:46 +00:00
webhookUpdate(id: $id, input: $input) {
errors {
2020-03-18 11:03:20 +00:00
...WebhookErrorFragment
2019-10-18 12:01:26 +00:00
}
2019-10-09 06:01:52 +00:00
webhook {
...WebhooksDetailsFragment
}
}
}
`;
const webhookDelete = gql`
2020-03-18 11:03:20 +00:00
${webhookErrorFragment}
2019-10-09 06:01:52 +00:00
mutation WebhookDelete($id: ID!) {
2019-10-09 06:56:46 +00:00
webhookDelete(id: $id) {
errors {
2020-03-18 11:03:20 +00:00
...WebhookErrorFragment
2019-10-09 06:01:52 +00:00
}
}
}
`;
Apps (#599) * create Apps view * create more app components, generate types and messages * apps refactor, update snapshots * show error message in tooltip when app installation fail * update apps components and view, add apps list to storybook * update defaultMessages * create app details view * update AppListPage with Skeleton component * create app activate/deactivate dialogs, create app details stories * add AppHeader to AppDetailsPage * update defaultMessages * update AppDetails view and components after review * create custom app details view * refactor webhooks * update webhooks fixtures * update WebhookDetailsPage story * update strings * create CustomAppCreate view and components * update AppListPage story * create AppInstall view and page * handle errors in AppInstall view * update defaultMessages * add AppInstallPage to storybook * add status prop to MessageManager * update defaultMessages * remove service account section * remove service account routes * remove as operator from notify status * add notifications for app installations * update styles for deactivated app * update app installations with local storage * update defaultMessages * AppInstall update * dd delete button to ongoin installations table * fix active installations condition * fix error messages in AppsList * update defaultMessages * add iframe to AppDetailsPage * create AppDetailsSettingsPage * install macaw-ui * apps styles clean up * update schema, fixtures * few apps updates * WebhookCreate - fix onBack button name * WebhookCreatePage story update * rename apps table from external to thirdparty * update defaultMessages * fix test, update snapshots * AppDetailsSettings - add token to headers * fix first number in local apps query * app details settings - use shop domain host * add onSettingsRowClick to InstalledApps * resolve conflicts * update changelog and messages * add noopener noreferrer do app privacy link * update snapshots * update snapshots * updates after review * update defaultMessages * CustomAppDetails - add missing notify status
2020-07-22 10:54:15 +00:00
export const useWebhookCreateMutation = makeMutation<
WebhookCreate,
WebhookCreateVariables
>(webhookCreate);
export const useWebhookDeleteMutation = makeMutation<
2019-10-09 06:01:52 +00:00
WebhookDelete,
WebhookDeleteVariables
2019-10-10 05:38:21 +00:00
>(webhookDelete);
Apps (#599) * create Apps view * create more app components, generate types and messages * apps refactor, update snapshots * show error message in tooltip when app installation fail * update apps components and view, add apps list to storybook * update defaultMessages * create app details view * update AppListPage with Skeleton component * create app activate/deactivate dialogs, create app details stories * add AppHeader to AppDetailsPage * update defaultMessages * update AppDetails view and components after review * create custom app details view * refactor webhooks * update webhooks fixtures * update WebhookDetailsPage story * update strings * create CustomAppCreate view and components * update AppListPage story * create AppInstall view and page * handle errors in AppInstall view * update defaultMessages * add AppInstallPage to storybook * add status prop to MessageManager * update defaultMessages * remove service account section * remove service account routes * remove as operator from notify status * add notifications for app installations * update styles for deactivated app * update app installations with local storage * update defaultMessages * AppInstall update * dd delete button to ongoin installations table * fix active installations condition * fix error messages in AppsList * update defaultMessages * add iframe to AppDetailsPage * create AppDetailsSettingsPage * install macaw-ui * apps styles clean up * update schema, fixtures * few apps updates * WebhookCreate - fix onBack button name * WebhookCreatePage story update * rename apps table from external to thirdparty * update defaultMessages * fix test, update snapshots * AppDetailsSettings - add token to headers * fix first number in local apps query * app details settings - use shop domain host * add onSettingsRowClick to InstalledApps * resolve conflicts * update changelog and messages * add noopener noreferrer do app privacy link * update snapshots * update snapshots * updates after review * update defaultMessages * CustomAppDetails - add missing notify status
2020-07-22 10:54:15 +00:00
export const useWebhookUpdateMutation = makeMutation<
WebhookUpdate,
WebhookUpdateVariables
>(webhookUpdate);