@@ -10,22 +10,22 @@ export const apiBaseUrl: string =
1010
1111@customElement ( "register-user" )
1212export class RegisterUser extends LitElement {
13- @state ( ) protected accessToken : string = "" ;
13+ @state ( ) protected userId : string = "" ;
1414 @state ( ) protected isLoading = false ;
1515 @state ( ) protected hasError = false ;
1616 @state ( ) protected username : string = "" ;
1717
1818 constructor ( ) {
1919 super ( ) ;
20- this . getAccessToken ( ) ;
20+ this . getUserId ( ) ;
2121 }
2222
2323 protected renderLoading = ( ) => html `<p> Loading...</ p> ` ;
2424
2525 protected copyUserIdToClipboard = async ( ) => {
26- if ( this . accessToken ) {
26+ if ( this . userId ) {
2727 try {
28- await navigator . clipboard . writeText ( this . accessToken ) ;
28+ await navigator . clipboard . writeText ( this . userId ) ;
2929 // Select the user-id text
3030 const pre = this . renderRoot . querySelector ( ".user-id" ) ;
3131 if ( pre ) {
@@ -61,7 +61,7 @@ export class RegisterUser extends LitElement {
6161 <div> <pre> ${ this . username } </ pre> </ div>
6262 <p> Unique user ID : </ p>
6363 <div class= "user-id-row" >
64- <pre class= "user-id" > ${ this . accessToken } </ pre>
64+ <pre class= "user-id" > ${ this . userId } </ pre>
6565 <butto n
6666 class= "copy-button"
6767 @click = "${ this . copyUserIdToClipboard } "
@@ -79,22 +79,22 @@ export class RegisterUser extends LitElement {
7979 </ div>
8080 ` ;
8181
82- protected getAccessToken = async ( ) => {
82+ protected getUserId = async ( ) => {
8383 this . isLoading = true ;
8484 this . hasError = false ;
8585 try {
8686 const authDetails = await getUserInfo ( ) ;
8787 if ( ! authDetails ) return ;
8888 this . username = authDetails . userDetails ;
8989
90- const response = await fetch ( `${ apiBaseUrl } /api/me/access-token ` ) ;
90+ const response = await fetch ( `${ apiBaseUrl } /me ` ) ;
9191 if ( ! response . ok ) {
92- throw new Error ( "An error occurred while fetching the access token " ) ;
92+ throw new Error ( "An error occurred while fetching the user ID " ) ;
9393 }
9494 const data = await response . json ( ) ;
95- this . accessToken = data . accessToken ;
95+ this . userId = data . userId ;
9696 } catch ( error ) {
97- console . error ( "Error fetching access token :" , error ) ;
97+ console . error ( "Error fetching user ID :" , error ) ;
9898 this . hasError = true ;
9999 } finally {
100100 this . isLoading = false ;
@@ -111,7 +111,7 @@ export class RegisterUser extends LitElement {
111111 : this . renderRegistrationCard ( ) ;
112112 }
113113
114- static styles = css `
114+ static override styles = css `
115115 : host {
116116 max-width : 1280px ;
117117 margin : 0 auto;
0 commit comments