1
1
"use client" ;
2
2
import React , { Suspense , useEffect , useState } from "react" ;
3
3
import { useSearchParams } from "next/navigation" ;
4
- import {
5
- Card ,
6
- Title ,
7
- Text ,
8
- TextInput ,
9
- Callout ,
10
- Button ,
11
- Grid ,
12
- Col ,
13
- } from "@tremor/react" ;
4
+ import { Card , Title , Text , TextInput , Callout , Button , Grid , Col } from "@tremor/react" ;
14
5
import { RiAlarmWarningLine , RiCheckboxCircleLine } from "@remixicon/react" ;
15
6
import {
16
7
invitationClaimCall ,
17
8
userUpdateUserCall ,
18
9
getOnboardingCredentials ,
19
10
claimOnboardingToken ,
20
11
getUiConfig ,
21
- getProxyBaseUrl
12
+ getProxyBaseUrl ,
22
13
} from "@/components/networking" ;
23
14
import { jwtDecode } from "jwt-decode" ;
24
15
import { Form , Button as Button2 , message } from "antd" ;
@@ -27,7 +18,7 @@ import { getCookie } from "@/utils/cookieUtils";
27
18
export default function Onboarding ( ) {
28
19
const [ form ] = Form . useForm ( ) ;
29
20
const searchParams = useSearchParams ( ) ! ;
30
- const token = getCookie ( ' token' ) ;
21
+ const token = getCookie ( " token" ) ;
31
22
const inviteID = searchParams . get ( "invitation_id" ) ;
32
23
const action = searchParams . get ( "action" ) ;
33
24
const [ accessToken , setAccessToken ] = useState < string | null > ( null ) ;
@@ -39,14 +30,16 @@ export default function Onboarding() {
39
30
const [ getUiConfigLoading , setGetUiConfigLoading ] = useState < boolean > ( true ) ;
40
31
41
32
useEffect ( ( ) => {
42
- getUiConfig ( ) . then ( ( data ) => { // get the information for constructing the proxy base url, and then set the token and auth loading
33
+ getUiConfig ( ) . then ( ( data ) => {
34
+ // get the information for constructing the proxy base url, and then set the token and auth loading
43
35
console . log ( "ui config in onboarding.tsx:" , data ) ;
44
36
setGetUiConfigLoading ( false ) ;
45
37
} ) ;
46
38
} , [ ] ) ;
47
39
48
40
useEffect ( ( ) => {
49
- if ( ! inviteID || getUiConfigLoading ) { // wait for the ui config to be loaded
41
+ if ( ! inviteID || getUiConfigLoading ) {
42
+ // wait for the ui config to be loaded
50
43
return ;
51
44
}
52
45
@@ -72,14 +65,7 @@ export default function Onboarding() {
72
65
} , [ inviteID , getUiConfigLoading ] ) ;
73
66
74
67
const handleSubmit = ( formValues : Record < string , any > ) => {
75
- console . log (
76
- "in handle submit. accessToken:" ,
77
- accessToken ,
78
- "token:" ,
79
- jwtToken ,
80
- "formValues:" ,
81
- formValues
82
- ) ;
68
+ console . log ( "in handle submit. accessToken:" , accessToken , "token:" , jwtToken , "formValues:" , formValues ) ;
83
69
if ( ! accessToken || ! jwtToken ) {
84
70
return ;
85
71
}
@@ -89,12 +75,7 @@ export default function Onboarding() {
89
75
if ( ! userID || ! inviteID ) {
90
76
return ;
91
77
}
92
- claimOnboardingToken (
93
- accessToken ,
94
- inviteID ,
95
- userID ,
96
- formValues . password
97
- ) . then ( ( data ) => {
78
+ claimOnboardingToken ( accessToken , inviteID , userID , formValues . password ) . then ( ( data ) => {
98
79
let litellm_dashboard_ui = "/ui/" ;
99
80
litellm_dashboard_ui += "?login=success" ;
100
81
@@ -119,15 +100,14 @@ export default function Onboarding() {
119
100
< Card >
120
101
< Title className = "text-sm mb-5 text-center" > 🚅 LiteLLM</ Title >
121
102
< Title className = "text-xl" > { action === "reset_password" ? "Reset Password" : "Sign up" } </ Title >
122
- < Text > { action === "reset_password" ? "Reset your password to access Admin UI." : "Claim your user account to login to Admin UI." } </ Text >
103
+ < Text >
104
+ { action === "reset_password"
105
+ ? "Reset your password to access Admin UI."
106
+ : "Claim your user account to login to Admin UI." }
107
+ </ Text >
123
108
124
109
{ action !== "reset_password" && (
125
- < Callout
126
- className = "mt-4"
127
- title = "SSO"
128
- icon = { RiCheckboxCircleLine }
129
- color = "sky"
130
- >
110
+ < Callout className = "mt-4" title = "SSO" icon = { RiCheckboxCircleLine } color = "sky" >
131
111
< Grid numItems = { 2 } className = "flex justify-between items-center" >
132
112
< Col > SSO is under the Enterprise Tier.</ Col >
133
113
@@ -142,28 +122,16 @@ export default function Onboarding() {
142
122
</ Callout >
143
123
) }
144
124
145
- < Form
146
- className = "mt-10 mb-5 mx-auto"
147
- layout = "vertical"
148
- onFinish = { handleSubmit }
149
- >
125
+ < Form className = "mt-10 mb-5 mx-auto" layout = "vertical" onFinish = { handleSubmit } >
150
126
< >
151
127
< Form . Item label = "Email Address" name = "user_email" >
152
- < TextInput
153
- type = "email"
154
- disabled = { true }
155
- value = { userEmail }
156
- defaultValue = { userEmail }
157
- className = "max-w-md"
158
- />
128
+ < TextInput type = "email" disabled = { true } value = { userEmail } defaultValue = { userEmail } className = "max-w-md" />
159
129
</ Form . Item >
160
130
161
131
< Form . Item
162
132
label = "Password"
163
133
name = "password"
164
- rules = { [
165
- { required : true , message : "password required to sign up" } ,
166
- ] }
134
+ rules = { [ { required : true , message : "password required to sign up" } ] }
167
135
help = { action === "reset_password" ? "Enter your new password" : "Create a password for your account" }
168
136
>
169
137
< TextInput placeholder = "" type = "password" className = "max-w-md" />
0 commit comments