mirror of
https://github.com/hexastack/hexabot
synced 2024-11-24 13:05:15 +00:00
Merge pull request #131 from Emnaghz/fix/frontend-lint-tests
fix: lint errors
This commit is contained in:
commit
578fbc2a47
@ -10,7 +10,6 @@ import {
|
|||||||
enqueueSnackbar,
|
enqueueSnackbar,
|
||||||
SnackbarProvider as ToastProvider,
|
SnackbarProvider as ToastProvider,
|
||||||
} from "notistack";
|
} from "notistack";
|
||||||
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
export { ToastProvider };
|
export { ToastProvider };
|
||||||
@ -41,7 +40,6 @@ const TOAST_WARNING_STYLE = {
|
|||||||
|
|
||||||
export const useToast = () => {
|
export const useToast = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const extractErrorMessage = (error: any) => {
|
const extractErrorMessage = (error: any) => {
|
||||||
if (error?.statusCode == 409) {
|
if (error?.statusCode == 409) {
|
||||||
return t("message.duplicate_error");
|
return t("message.duplicate_error");
|
||||||
@ -54,6 +52,7 @@ export const useToast = () => {
|
|||||||
toast: {
|
toast: {
|
||||||
error: (error: any, options?: OptionsObject<"error">) => {
|
error: (error: any, options?: OptionsObject<"error">) => {
|
||||||
const errorMessage = extractErrorMessage(error);
|
const errorMessage = extractErrorMessage(error);
|
||||||
|
|
||||||
enqueueSnackbar(errorMessage, {
|
enqueueSnackbar(errorMessage, {
|
||||||
variant: "error",
|
variant: "error",
|
||||||
...options,
|
...options,
|
||||||
|
Loading…
Reference in New Issue
Block a user