Missign translation
This commit is contained in:
parent
581cacb636
commit
683b6020b7
14
exam/README.md
Normal file
14
exam/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Veränderungen Datenbank
|
||||
|
||||
## Tabelle `egb_benutzer`
|
||||
- Neue Spalten `token` (Auth token): VarChar(36), Nullable, UNIQUE Constraint
|
||||
- Abänderung der Spalte `zeitstempel`: Entfernen des `ON UPDATE` (da sonst die Mitgliedszeit beim Ändern der Daten sich ändert)
|
||||
- Abänderung der Spalte `benutzername`: Non-Nullable gemacht, UNIQUE Constraint
|
||||
- Abänderung der Spalte `email`: Non-Nullable gemacht, UNIQUE Constraint
|
||||
- Abänderung der Spalte `passwort`: Non-Nullable gemacht
|
||||
- Abänderung der Spalte `confirmationcode`: Default auf `NULL` gesetzt
|
||||
|
||||
## Tabelle `egb_gaestebuch`
|
||||
- Abänderung der Spalte `benutzer_id`: Non-Nullable gemacht
|
||||
- Abänderung der Spalte `beitrag`: Non-Nullable gemacht
|
||||
- Hinzufüge eines Foreign Key Constraints auf `benutzer_id`
|
||||
1
exam/dist/assets/index-CmwTmvyQ.js
vendored
1
exam/dist/assets/index-CmwTmvyQ.js
vendored
File diff suppressed because one or more lines are too long
1
exam/dist/assets/index-DNzu9OIf.js
vendored
Normal file
1
exam/dist/assets/index-DNzu9OIf.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
exam/dist/index.html
vendored
2
exam/dist/index.html
vendored
@ -5,7 +5,7 @@
|
||||
<link rel="icon" type="image/svg+xml" href="/phpCourse/exam/dist/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + React + TS</title>
|
||||
<script type="module" crossorigin src="/phpCourse/exam/dist/assets/index-CmwTmvyQ.js"></script>
|
||||
<script type="module" crossorigin src="/phpCourse/exam/dist/assets/index-DNzu9OIf.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/react-DXd9vB-a.js">
|
||||
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/mui-BZej3Yg3.js">
|
||||
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/tanstack-DeUNQvBN.js">
|
||||
|
||||
6
exam/dist/locales/de/translation.json
vendored
6
exam/dist/locales/de/translation.json
vendored
@ -1,9 +1,11 @@
|
||||
{
|
||||
"Unauthorized": "Keine Berechtigung",
|
||||
|
||||
"NotFound_user:login": "Benutzer existiert nicht",
|
||||
"Unauthorized_login": "Ungültige E-Mail oder Passwort",
|
||||
|
||||
"Unauthorized_delete": "Keine Berechtigung",
|
||||
"NotFound_post:delete": "Post nicht gefunden",
|
||||
"Unauthorized_deletePost": "Keine Berechtigung",
|
||||
"NotFound_post:deletePost": "Post nicht gefunden",
|
||||
|
||||
"Unauthorized_userUpdate": "Keine Berechtigung",
|
||||
"NotFound_user:userUpdate": "Benutzer nicht gefunden",
|
||||
|
||||
6
exam/dist/locales/en/translation.json
vendored
6
exam/dist/locales/en/translation.json
vendored
@ -1,9 +1,11 @@
|
||||
{
|
||||
"Unauthorized": "Unauthorized",
|
||||
|
||||
"NotFound_user:login": "User does not exist",
|
||||
"Unauthorized_login": "Invalid email or password",
|
||||
|
||||
"Unauthorized_delete": "Unauthorized",
|
||||
"NotFound_post:delete": "Post not found",
|
||||
"Unauthorized_deletPost": "Unauthorized",
|
||||
"NotFound_post:deletePost": "Post not found",
|
||||
|
||||
"Unauthorized_userUpdate": "Unauthorized",
|
||||
"NotFound_user:userUpdate": "User not found",
|
||||
|
||||
2
exam/dist/stats.html
vendored
2
exam/dist/stats.html
vendored
File diff suppressed because one or more lines are too long
@ -1,9 +1,11 @@
|
||||
{
|
||||
"Unauthorized": "Keine Berechtigung",
|
||||
|
||||
"NotFound_user:login": "Benutzer existiert nicht",
|
||||
"Unauthorized_login": "Ungültige E-Mail oder Passwort",
|
||||
|
||||
"Unauthorized_delete": "Keine Berechtigung",
|
||||
"NotFound_post:delete": "Post nicht gefunden",
|
||||
"Unauthorized_deletePost": "Keine Berechtigung",
|
||||
"NotFound_post:deletePost": "Post nicht gefunden",
|
||||
|
||||
"Unauthorized_userUpdate": "Keine Berechtigung",
|
||||
"NotFound_user:userUpdate": "Benutzer nicht gefunden",
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
{
|
||||
"Unauthorized": "Unauthorized",
|
||||
|
||||
"NotFound_user:login": "User does not exist",
|
||||
"Unauthorized_login": "Invalid email or password",
|
||||
|
||||
"Unauthorized_delete": "Unauthorized",
|
||||
"NotFound_post:delete": "Post not found",
|
||||
"Unauthorized_deletPost": "Unauthorized",
|
||||
"NotFound_post:deletePost": "Post not found",
|
||||
|
||||
"Unauthorized_userUpdate": "Unauthorized",
|
||||
"NotFound_user:userUpdate": "User not found",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Typography } from '@mui/material';
|
||||
import { Typography, TypographyTypeMap } from '@mui/material';
|
||||
import { FC } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ERRORS } from './Errors';
|
||||
@ -7,9 +7,10 @@ interface Props {
|
||||
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
error: any;
|
||||
context?: string;
|
||||
color?: TypographyTypeMap['props']['color'];
|
||||
}
|
||||
|
||||
const ErrorComponent: FC<Props> = ({ error, context }) => {
|
||||
const ErrorComponent: FC<Props> = ({ error, context, color = 'error.main' }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (!error) return null;
|
||||
@ -17,19 +18,19 @@ const ErrorComponent: FC<Props> = ({ error, context }) => {
|
||||
if (error.code) {
|
||||
switch (error.code) {
|
||||
case ERRORS.NOT_FOUND:
|
||||
return <Typography color="error.main">{t(error.code, { context: `${error.entity}:${context}` })}</Typography>;
|
||||
return <Typography color={color}>{t(error.code, { context: `${error.entity}:${context}` })}</Typography>;
|
||||
case ERRORS.UNAUTHORIZED:
|
||||
return <Typography color="error.main">{t(error.code, { context })}</Typography>;
|
||||
return <Typography color={color}>{t(error.code, { context })}</Typography>;
|
||||
case ERRORS.FAILEDUPDATE:
|
||||
return error.fields.map((field: string) => (
|
||||
<Typography key={`error_${field}`} color="error.main">
|
||||
<Typography key={`error_${field}`} color={color}>
|
||||
{t(error.code, { context, name: t(field) })}
|
||||
</Typography>
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return <Typography color="error.main">{t(error?.message ?? 'Unknown', { context })}</Typography>;
|
||||
return <Typography color={color}>{t(error?.message ?? 'Unknown', { context })}</Typography>;
|
||||
};
|
||||
|
||||
export default ErrorComponent;
|
||||
|
||||
@ -31,6 +31,8 @@ interface Props {
|
||||
|
||||
const Post: FC<Props> = ({ post }) => {
|
||||
const [open, setOpen] = useState(false);
|
||||
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const [error, setError] = useState<any>();
|
||||
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: (id: number) => {
|
||||
@ -112,6 +114,7 @@ const Post: FC<Props> = ({ post }) => {
|
||||
queryKey: ['posts'],
|
||||
});
|
||||
},
|
||||
onError: setError,
|
||||
});
|
||||
setOpen(false);
|
||||
}}
|
||||
@ -123,9 +126,18 @@ const Post: FC<Props> = ({ post }) => {
|
||||
</>
|
||||
)}
|
||||
</CardActions>
|
||||
<Snackbar open={deleteMutation.isError} autoHideDuration={2000} onClose={() => deleteMutation.reset()}>
|
||||
<Snackbar
|
||||
open={deleteMutation.isError}
|
||||
autoHideDuration={2000}
|
||||
onClose={() => {
|
||||
deleteMutation.reset();
|
||||
}}
|
||||
TransitionProps={{
|
||||
onExited: () => setError(undefined),
|
||||
}}
|
||||
>
|
||||
<Alert severity="error" variant="filled" sx={{ width: '100%' }}>
|
||||
{deleteMutation.isError && <ErrorComponent error={deleteMutation.error} context="delete" />}
|
||||
{error && <ErrorComponent error={error} context="delete" color="white" />}
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
<Snackbar open={deleteMutation.isPending} message={t('Deleting')} />
|
||||
|
||||
@ -15,7 +15,7 @@ const Root = () => {
|
||||
<>
|
||||
<Header />
|
||||
<Box sx={{ display: 'flex', justifyContent: 'center' }}>
|
||||
<Box sx={{ maxWidth: '800px' }}>
|
||||
<Box sx={{ maxWidth: '800px', flexGrow: 1 }}>
|
||||
<Outlet />
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user