Post list fixes

This commit is contained in:
Kilian Hofmann 2024-07-25 21:00:34 +02:00
parent bb1e0eebf5
commit 202e89382a
55 changed files with 215 additions and 183 deletions

View File

@ -126,7 +126,7 @@ class Post implements JsonSerializable
$stmt->bindValue(":ID", $this->id); $stmt->bindValue(":ID", $this->id);
try { try {
if (!$stmt->execute()) throw ApiError::failedUpdate(["content"]); if (!$stmt->execute()) throw ApiError::failedUpdate(["content"]);
} catch (Exception) { } catch (Exception $e) {
throw ApiError::failedUpdate(["content"]); throw ApiError::failedUpdate(["content"]);
} }
} }

193
exam/dist/assets/index-BJXidBC9.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
exam/dist/assets/index-D83Ey19k.css vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -5,7 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/phpCourse/exam/dist/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/phpCourse/exam/dist/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title> <title>Vite + React + TS</title>
<script type="module" crossorigin src="/phpCourse/exam/dist/assets/index-BObjV29d.js"></script> <script type="module" crossorigin src="/phpCourse/exam/dist/assets/index-BJXidBC9.js"></script>
<link rel="stylesheet" crossorigin href="/phpCourse/exam/dist/assets/index-D83Ey19k.css">
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>

View File

@ -6,19 +6,21 @@ import Api from '../api/Api';
import Header from '../components/Header/Header'; import Header from '../components/Header/Header';
import useGuestBookStore from '../store/store'; import useGuestBookStore from '../store/store';
export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()({ const Root = () => {
component: () => { //FIXME: REAUTH HERE
//FIXME: REAUTH HERE const token = useGuestBookStore((state) => state.token);
const token = useGuestBookStore((state) => state.token); Api.token = token;
Api.token = token;
return ( return (
<> <>
<Header /> <Header />
<Toolbar /> <Toolbar />
<Outlet /> <Outlet />
{process.env.NODE_ENV === 'development' && <TanStackRouterDevtools />} {process.env.NODE_ENV === 'development' && <TanStackRouterDevtools />}
</> </>
); );
}, };
export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()({
component: Root,
}); });

View File

@ -7,10 +7,11 @@ import { TFunction } from 'i18next';
* @param t Optional translation function, defautls to pass through * @param t Optional translation function, defautls to pass through
* @returns Translated error or inputs if t as unspecified * @returns Translated error or inputs if t as unspecified
*/ */
//eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleError = ( const handleError = (
//eslint-disable-next-line @typescript-eslint/no-explicit-any
error: any, error: any,
context?: string, context?: string,
//eslint-disable-next-line @typescript-eslint/no-explicit-any
t: TFunction<'translation', undefined> | ((..._in: any) => any) = (..._in: any) => _in t: TFunction<'translation', undefined> | ((..._in: any) => any) = (..._in: any) => _in
): string => { ): string => {
if (!error) return t('', {}); if (!error) return t('', {});