style: format web/src with oxfmt defaults (via vp fmt)
One-time mechanical sweep, isolated from any functional change. - oxfmt defaults: double quotes, semicolons, 2-space indent, LF, printWidth 100, trailing commas, bracket spacing, arrow parens. - vite.config.ts gains an fmt.ignorePatterns block for web/static: vendored/minified assets (htmx.min.js, compiled css) must never be reformatted. - Verified: rebuild after the sweep produces byte-identical JS/CSS bundles; only sourcemaps changed (they embed sourcesContent).
This commit is contained in:
1 parent
8aeecaa0ef
commit
77cd268f4e
37 files changed
+1151
-1853
No files matched your search
+6
-19
@@ -37,10 +37,7 @@ async function apiPut(url: string, data?: unknown): Promise<Response> {
|
||||
});
|
||||
}
|
||||
|
||||
async function apiDelete<T extends object>(
|
||||
url: string,
|
||||
data?: T,
|
||||
): Promise<Response> {
|
||||
async function apiDelete<T extends object>(url: string, data?: T): Promise<Response> {
|
||||
return fetch(`/api${url}`, {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
@@ -64,9 +61,7 @@ async function apiPatch(url: string, data?: unknown): Promise<Response> {
|
||||
|
||||
async function handleResponse<T>(response: Response): Promise<T> {
|
||||
if (!response.ok) {
|
||||
const errorData = await response
|
||||
.json()
|
||||
.catch(() => ({ error: "Unknown error" }));
|
||||
const errorData = await response.json().catch(() => ({ error: "Unknown error" }));
|
||||
throw new Error(errorData.error || `HTTP ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
@@ -74,17 +69,14 @@ async function handleResponse<T>(response: Response): Promise<T> {
|
||||
|
||||
async function handleVoidResponse(response: Response): Promise<void> {
|
||||
if (!response.ok) {
|
||||
const errorData = await response
|
||||
.json()
|
||||
.catch(() => ({ error: "Unknown error" }));
|
||||
const errorData = await response.json().catch(() => ({ error: "Unknown error" }));
|
||||
throw new Error(errorData.error || `HTTP ${response.status}`);
|
||||
}
|
||||
}
|
||||
|
||||
function handleError(error: unknown, context: string): void {
|
||||
console.error(`${context}:`, error);
|
||||
const message =
|
||||
error instanceof Error ? error.message : "An unexpected error occurred";
|
||||
const message = error instanceof Error ? error.message : "An unexpected error occurred";
|
||||
showToast(message, "error");
|
||||
}
|
||||
|
||||
@@ -106,16 +98,11 @@ async function updateReadingProgress(
|
||||
mediaItemId: string,
|
||||
progress: ReadingProgress,
|
||||
): Promise<void> {
|
||||
const response = await apiPut(
|
||||
`/media-items/${mediaItemId}/progress`,
|
||||
progress,
|
||||
);
|
||||
const response = await apiPut(`/media-items/${mediaItemId}/progress`, progress);
|
||||
await handleVoidResponse(response);
|
||||
}
|
||||
|
||||
async function getReadingProgress(
|
||||
mediaItemId: string,
|
||||
): Promise<ReadingProgress | null> {
|
||||
async function getReadingProgress(mediaItemId: string): Promise<ReadingProgress | null> {
|
||||
const response = await apiGet(`/media-items/${mediaItemId}/progress`);
|
||||
|
||||
if (response.status === 404) {
|
||||
|
||||
Reference in new issue
Block a user