Last active
October 14, 2022 01:21
-
-
Save ajcrites/69caa111d2244c1b3e0e3e0d7b0c7bf2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const GAME_WEB_FORMAT_URL = '/#{sessionId}/game/format'; | |
export const GAME_WEB_APP_URL = 'https://qa.game.com'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component(...) | |
export class ProfilePage { | |
... | |
async getSpecialApp() { | |
const userId = await this.userService.getUserId(); | |
const token = userId?.token; | |
if (token) { | |
this.formatUserId(token).subscribe((id) => { | |
if (id) { | |
const url = [GAME_WEB_APP_URL, id].join('?'); | |
Browser.open(url); | |
} | |
}); | |
} | |
} | |
async formatUserId(token: any) { | |
return from(this.http.get( | |
this.urlBuilder.build(GAME_WEB_FORMAT_URL, { | |
sessionId: this.sessionId, | |
listId: this.listId, | |
}, { | |
queryParams: { userToken: token }, | |
}); | |
)).pipe( | |
map((response: any) => { | |
console.log(response, 'got id'); | |
return response.body.formattedId; | |
}), | |
catchError((e) => { | |
console.warn('Failed to format token'); | |
return of(e); | |
}) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment