File tree Expand file tree Collapse file tree 2 files changed +15
-11
lines changed
Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,7 @@ LICENSE_DIR=./licenses/
22BUILD_DIR =./build
33DOCKER_DIR =./docker/
44SHELL := /bin/bash
5- ifdef GOTOOLCHAIN
6- GO_VERSION=$(GOTOOLCHAIN)
7- else
8- GO_VERSION=$(shell go mod edit -json | jq -r .Toolchain | sed -e 's/go//')
9- endif
5+ GO_VERSION =$(shell go mod edit -json | jq -r .Toolchain | sed -e 's/go//')
106DOCKER_BUILD_IMAGE =docker.io/gotify/build
117DOCKER_WORKDIR =/proj
128DOCKER_RUN =docker run --rm -e LD_FLAGS="$$LD_FLAGS" -v "$$PWD/.:${DOCKER_WORKDIR}" -v "` go env GOPATH ` /pkg/mod/.:/go/pkg/mod:ro" -w ${DOCKER_WORKDIR}
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ const Layout = observer(() => {
5555 const {
5656 currentUser : {
5757 loggedIn,
58+ authenticating,
5859 user : { name, admin} ,
5960 logout,
6061 tryReconnect,
@@ -79,7 +80,9 @@ const Layout = observer(() => {
7980 } ;
8081
8182 const authed = ( children : React . ReactNode ) => (
82- < RequireAuth loggedIn = { loggedIn } > { children } </ RequireAuth >
83+ < RequireAuth loggedIn = { loggedIn } authenticating = { authenticating } >
84+ { children }
85+ </ RequireAuth >
8386 ) ;
8487
8588 return (
@@ -167,11 +170,16 @@ const Lazy = ({component}: {component: () => Promise<{default: React.ComponentTy
167170 ) ;
168171} ;
169172
170- const RequireAuth : React . FC < React . PropsWithChildren < { loggedIn : boolean } > > = ( {
171- children,
172- loggedIn,
173- } ) => {
174- return loggedIn ? < > { children } </ > : < Navigate replace = { true } to = "/login" /> ;
173+ const RequireAuth : React . FC <
174+ React . PropsWithChildren < { loggedIn : boolean ; authenticating : boolean } >
175+ > = ( { children, authenticating, loggedIn} ) => {
176+ if ( authenticating ) {
177+ return < LoadingSpinner /> ;
178+ }
179+ if ( ! loggedIn ) {
180+ return < Navigate replace = { true } to = "/login" /> ;
181+ }
182+ return < > { children } </ > ;
175183} ;
176184
177185export default Layout ;
You can’t perform that action at this time.
0 commit comments