Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Last active October 14, 2022 01:21
Show Gist options
  • Save ajcrites/69caa111d2244c1b3e0e3e0d7b0c7bf2 to your computer and use it in GitHub Desktop.
Save ajcrites/69caa111d2244c1b3e0e3e0d7b0c7bf2 to your computer and use it in GitHub Desktop.
export const GAME_WEB_FORMAT_URL = '/#{sessionId}/game/format';
export const GAME_WEB_APP_URL = 'https://qa.game.com';
@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