From f76970b5a33c100d89f990a09482b68242c5d533 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Wed, 18 Dec 2024 15:24:42 +0000 Subject: [PATCH] chore: explicit function origin (#2945) Nothing world changing. I realised recently that I prefer explicitly calling methods of stores and do the same with their states. Similar to how one would do that with classes. Since I might make more changes like this in the future (maybe also part of other PRs) I though I'd explain my reasoning here in a bit more detail: __Benefits__ - saves local mappings, like the `const updateConfig = () => configStore.update()` - there is no need to look up what exactly is updated, since the function is provide by the store. __Disadvantages__ - a little bit more verbose (but not thaaat big difference) --- TLDR: When reading the code this saves the step to check what was mapped. Reviewed-on: https://kolaente.dev/vikunja/vikunja/pulls/2945 Reviewed-by: konrad Co-authored-by: Dominik Pschenitschni Co-committed-by: Dominik Pschenitschni --- frontend/src/helpers/checkAndSetApiUrl.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/src/helpers/checkAndSetApiUrl.ts b/frontend/src/helpers/checkAndSetApiUrl.ts index 282c7281f..3ac1770c8 100644 --- a/frontend/src/helpers/checkAndSetApiUrl.ts +++ b/frontend/src/helpers/checkAndSetApiUrl.ts @@ -51,10 +51,9 @@ export const checkAndSetApiUrl = (url: string | undefined | null): Promise configStore.update() // Check if the api is reachable at the provided url - return updateConfig() + return configStore.update() .catch(e => { // Check if it is reachable at /api/v1 and http if ( @@ -63,7 +62,7 @@ export const checkAndSetApiUrl = (url: string | undefined | null): Promise