import { translate } from "@/plugins/i18n";
import { BaseError } from "../base/BaseError";
import { useSnackbarStore } from "@/store/SnackbarStore";

export class UnprocessableEntityError extends BaseError {
  message = translate("errorMessages.UnprocessableEntityError");

  dispatchError() {
    Object.values(this.data.errors ?? []).forEach((error) => {
      if (error) {
        useSnackbarStore().showSnackbar(`${error}`, { color: "error" });
      }
    });
  }
}
