- Implemented RESTful API routes for telework authorizations, including GET and POST methods for retrieving and saving authorizations. - Created Sequelize repository for managing telework authorization data with methods for loading and saving authorizations. - Developed migration scripts to set up necessary database tables for telework authorizations and revisions. - Added persistence mapping for telework authorization entities to facilitate data transformation between domain and database layers. - Introduced common schemas for validating telework authorization requests and responses using Zod. - Built frontend components for managing telework authorizations, including forms for creating and editing authorizations, and summaries for displaying authorization details. - Integrated internationalization support for English and Spanish languages in the telework module. - Added unit tests to ensure functionality and correctness of telework authorization components and API interactions.
19 lines
537 B
TypeScript
19 lines
537 B
TypeScript
import { useTranslation } from "react-i18next";
|
|
|
|
import { TeleworkApiError } from "./telework-api";
|
|
export function TeleworkFeedback({ error }: { error: unknown }) {
|
|
const { t } = useTranslation("companies");
|
|
if (!error) {
|
|
return null;
|
|
}
|
|
const key =
|
|
error instanceof TeleworkApiError
|
|
? `telework.errors.${error.code}`
|
|
: "telework.errors.INTERNAL_ERROR";
|
|
return (
|
|
<p className="text-sm text-destructive" role="alert">
|
|
{t(key, { defaultValue: t("telework.errors.INTERNAL_ERROR") })}
|
|
</p>
|
|
);
|
|
}
|