Skip to content

Commit

Permalink
save discord login
Browse files Browse the repository at this point in the history
  • Loading branch information
Metal079 committed Dec 18, 2023
1 parent 3885cb2 commit bce3718
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/app/home/options/options.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,17 @@ export class OptionsComponent {
this.supporter = userData.has_required_role;
this.serverMember = userData.is_member_of_your_guild;
console.log('premium member!');
this.onDiscordLoginSuccess(userData);
}
});

const storedUserData = localStorage.getItem('discordUserData');
if (storedUserData) {
const userData = JSON.parse(storedUserData);
this.supporter = userData.has_required_role;
this.serverMember = userData.is_member_of_your_guild;
this.sharedService.setUserData(userData);
}
}

ngOnDestroy() {
Expand Down Expand Up @@ -435,4 +444,9 @@ export class OptionsComponent {
openImageModal() {
this.imageModalOpen.emit(true);
}

// Example function called after successful Discord login
onDiscordLoginSuccess(userData: any) {
localStorage.setItem('discordUserData', JSON.stringify(userData));
}
}

0 comments on commit bce3718

Please sign in to comment.