@@ -37,7 +37,6 @@ import {
3737 FileRepositoryList ,
3838 GroupDetail ,
3939 GroupList ,
40- LoginPage ,
4140 MultiSearch ,
4241 MyImports ,
4342 MyNamespaces ,
@@ -59,7 +58,7 @@ import {
5958import { Paths , formatPath } from 'src/paths' ;
6059import { config } from 'src/ui-config' ;
6160import { loginURL } from 'src/utilities' ;
62- import { useUserContext } from './user -context' ;
61+ import { useAppContext } from './app -context' ;
6362
6463interface IRouteConfig {
6564 beta ?: boolean ;
@@ -234,11 +233,6 @@ const routes: IRouteConfig[] = [
234233 path : Paths . ansible . namespace . mine ,
235234 beta : true ,
236235 } ,
237- {
238- component : LoginPage ,
239- path : Paths . meta . login ,
240- noAuth : true ,
241- } ,
242236 {
243237 component : CollectionDocs ,
244238 path : Paths . ansible . collection . docs_page ,
@@ -322,10 +316,12 @@ const AuthHandler = ({
322316 noAuth,
323317 path,
324318} : IRouteConfig ) => {
325- const { credentials } = useUserContext ( ) ;
319+ const {
320+ account : { username } ,
321+ } = useAppContext ( ) ;
326322 const { pathname } = useLocation ( ) ;
327323
328- if ( ! credentials && ! noAuth ) {
324+ if ( ! username && ! noAuth ) {
329325 // NOTE: also update LoginLink when changing this
330326 if ( config . UI_EXTERNAL_LOGIN_URI ) {
331327 window . location . replace ( loginURL ( pathname ) ) ;
@@ -401,6 +397,11 @@ export const dataRoutes = [
401397 index : true ,
402398 loader : ( ) => redirect ( formatPath ( Paths . core . status ) ) ,
403399 } ,
400+ {
401+ path : 'login' ,
402+ id : 'login' ,
403+ lazy : ( ) => import ( 'src/routes/login' ) . then ( ( m ) => convert ( m ) ) ,
404+ } ,
404405 ...appRoutes ( ) ,
405406 // "No matching route" is not handled by the error boundary.
406407 { path : '*' , element : < NotFound /> } ,
0 commit comments