@@ -10,18 +10,7 @@ import InstanceName from "./InstanceName/InstanceName.tsx";
1010import Otp from "./Otp/Otp.tsx" ;
1111import OtpPicker from "./OtpPicker/OtpPicker.tsx" ;
1212import Profiles from "./Profiles/Profiles.tsx" ;
13-
14- // Region configuration
15- const REGIONS = {
16- "us-e1" : {
17- label : "United States East 1" ,
18- apiUrl : "https://api.tago.io" ,
19- } ,
20- "eu-w1" : {
21- label : "Europe West 1" ,
22- apiUrl : "https://api.eu-w1.tago.io" ,
23- } ,
24- } ;
13+ import { REGIONS } from "./regions.ts" ;
2514
2615/**
2716 * Props.
@@ -63,7 +52,7 @@ function Auth(props: IAuthProps) {
6352 const { onSignIn, port } = props ;
6453
6554 // Get the API URL based on selected region
66- const API_URL = REGIONS [ selectedRegion ] . apiUrl ;
55+ const apiUrl = REGIONS [ selectedRegion ] . apiUrl ;
6756
6857 /**
6958 * Logs in.
@@ -82,7 +71,7 @@ function Auth(props: IAuthProps) {
8271
8372 // logs in and gets the account
8473 const result = await axios . post (
85- `${ API_URL } /account/login` ,
74+ `${ apiUrl } /account/login` ,
8675 {
8776 email,
8877 password,
@@ -114,7 +103,7 @@ function Auth(props: IAuthProps) {
114103 setLoading ( false ) ;
115104 }
116105 } ,
117- [ email , password , loading , otpType , API_URL ] ,
106+ [ email , password , loading , otpType , apiUrl ] ,
118107 ) ;
119108
120109 /**
@@ -151,7 +140,7 @@ function Auth(props: IAuthProps) {
151140
152141 // uses the account to get a profile token
153142 // logs in and gets the account
154- const tokenData = await axios . post ( `${ API_URL } /account/profile/token` , {
143+ const tokenData = await axios . post ( `${ apiUrl } /account/profile/token` , {
155144 email,
156145 password,
157146 otp_type : lastPinCode ? otpType : undefined ,
@@ -170,7 +159,7 @@ function Auth(props: IAuthProps) {
170159 setLoading ( false ) ;
171160 }
172161 } ,
173- [ email , otpType , lastPinCode , password , API_URL ] ,
162+ [ email , otpType , lastPinCode , password , apiUrl ] ,
174163 ) ;
175164
176165 /**
@@ -205,14 +194,14 @@ function Auth(props: IAuthProps) {
205194 setContent ( "otp" ) ;
206195
207196 if ( newType !== "authenticator" ) {
208- await axios . post ( `${ API_URL } /account/login/otp` , {
197+ await axios . post ( `${ apiUrl } /account/login/otp` , {
209198 email,
210199 password,
211200 otp_type : newType ,
212201 } ) ;
213202 }
214203 } ,
215- [ email , password , API_URL ] ,
204+ [ email , password , apiUrl ] ,
216205 ) ;
217206
218207 /**
@@ -246,7 +235,6 @@ function Auth(props: IAuthProps) {
246235 password = { password }
247236 selectedRegion = { selectedRegion }
248237 onChangeRegion = { setSelectedRegion }
249- regions = { REGIONS }
250238 />
251239 ) : content === "profiles" ? (
252240 // profile selection
0 commit comments