Skip to content

Commit df0406d

Browse files
feat(universalLogin): use unauth-ed api endpoint to fetch login URL (#5940)
* feat(universalLogin): use unauth-ed api endpoint to fetch login URL * chore: prettier
1 parent a66e985 commit df0406d

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/onboarding/containers/LoginPage.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ import LoginPageContents from 'src/onboarding/containers/LoginPageContents'
2020
import {CLOUD} from 'src/shared/constants'
2121
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
2222

23-
let getQuartzLoginUrl
24-
25-
if (CLOUD) {
26-
getQuartzLoginUrl =
27-
require('src/client/uiproxydRoutes').getUiproxyQuartzLoginUrl
28-
}
29-
3023
const EMPTY_HISTORY_STACK_LENGTH = 2
3124

3225
export const LoginPage: FC = () => {
@@ -63,11 +56,21 @@ export const LoginPage: FC = () => {
6356
} else {
6457
if (isFlagEnabled('universalLogin')) {
6558
if (CLOUD) {
66-
getQuartzLoginUrl({})
59+
fetch('/api/env/quartz-login-url')
6760
.then(response => {
68-
const redirectUrl = response.data
69-
console.warn('Redirect to cloud url: ', redirectUrl)
70-
window.location.replace(redirectUrl)
61+
response
62+
.text()
63+
.then(response => {
64+
const redirectUrl = response
65+
console.warn('Redirect to cloud url: ', redirectUrl)
66+
window.location.replace(redirectUrl)
67+
})
68+
.catch(error => {
69+
console.error(
70+
'Failed to fetch /api/env/quartz-login-url',
71+
error
72+
)
73+
})
7174
})
7275
.catch(error => console.error(error))
7376
return

0 commit comments

Comments
 (0)