Skip to content

Commit

Permalink
apply some coderabbit suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Büßemeyer authored and Michael Büßemeyer committed Oct 24, 2024
1 parent 034fe9e commit 1a3675f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/javascripts/admin/api/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function doWithToken<T>(
fn: (token: string) => Promise<T>,
tries: number = 1,
useURLTokenIfAvailable: boolean = true,
): Promise<any> {
): Promise<T> {
let token =
useURLTokenIfAvailable && shouldUseURLToken ? getSharingTokenFromUrlParameters() : null;

Expand Down
6 changes: 3 additions & 3 deletions frontend/javascripts/libs/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class Request {
key: json.status.toString(),
}));
if (showErrorToast) {
Toast.messages(messages); // Toast.error already logs the error
Toast.messages(messages); // Note: Toast.error internally logs to console
} else {
console.error(messages);
}
Expand All @@ -324,9 +324,9 @@ class Request {
return Promise.reject({ ...json, url: requestedUrl });
} catch (_jsonError) {
if (showErrorToast) {
Toast.error(text); // Toast.error already logs the error
Toast.error(text); // Note: Toast.error internally logs to console
} else {
console.error(text);
console.error(`Request failed for ${requestedUrl}:`, text);
}

/* eslint-disable-next-line prefer-promise-reject-errors */
Expand Down

0 comments on commit 1a3675f

Please sign in to comment.