gotify / server

A simple server for sending and receiving messages in real-time per WebSocket. (Includes a sleek web-ui)
https://gotify.net
Other
11.49k stars 639 forks source link

have router navigate to expected route on page loads #721

Closed david-kalmakoff closed 2 weeks ago

david-kalmakoff commented 2 weeks ago

Is your feature request related to a problem? Please describe. If you are on a page other than the home page and refresh, you are brought back to the homepage. If you paste in a url such as https://<domain>/#/plugins it brings you to the home page instead of that page. It seems that the router navigates the /login then / on any page loads.

Describe the solution you'd like It would be great if the router brought you to the expected page on page loads. I would have to look some more into how the router is implemented to find a more specific solution.

Additional context This is something I would be happy to dive into if others find value in it.

jmattheis commented 2 weeks ago

Yeah, feel free to fix this, I see this as a bug.

It's likely that we only have to set authenticating = true, when calling tryAuthenticate in https://github.com/gotify/server/blob/master/ui/src/CurrentUser.ts#L101 (and this.authenticating = false when it's finished) as the Layout.tsx has this as first route

{authenticating ? (
    <Route path="/">
        <LoadingSpinner />
    </Route>
) : null}