mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
19 lines
556 B
TypeScript
19 lines
556 B
TypeScript
// Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
|
|
|
|
import {
|
|
NotificationTypes,
|
|
useNotifications,
|
|
} from '#shared/components/CommonNotifications/index.ts'
|
|
import UserError from '#shared/errors/UserError.ts'
|
|
|
|
import type { ApolloError } from '@apollo/client/core'
|
|
|
|
export const handleUserErrors = (error: UserError | ApolloError) => {
|
|
if (error instanceof UserError) {
|
|
useNotifications().notify({
|
|
id: error.userErrorId,
|
|
message: error.getFirstErrorMessage(),
|
|
type: NotificationTypes.Error,
|
|
})
|
|
}
|
|
}
|