Skip to content

Commit 8774194

Browse files
Merge pull request #127 from nullinside-development-group/feat/oauth
bug: twitch login oauth
2 parents 3556a6c + a94f4ce commit 8774194

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/src/app/view/twitch/twitch-bot-config/twitch-bot-config.component.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,27 @@ export class TwitchBotConfigComponent implements OnInit, OnDestroy {
8686
this.auth.validateToken(oauth.AccessToken).subscribe({
8787
next: _ => {
8888
this.auth.setToken(oauth);
89+
90+
// Check if the bot account is modded. If it isn't, we can offer to mod it.
91+
this.twitchBotApi.getIsMod().subscribe({
92+
next: response => {
93+
this.botIsMod = response.isMod;
94+
},
95+
error: err => {
96+
this.botIsMod = false;
97+
this.error = 'Unable to determine if nullinside is a mod in your channel';
98+
console.log(err);
99+
}
100+
});
101+
102+
// Get the person's existing configuration.
103+
this.twitchBotApi.getConfig().subscribe({
104+
next: response => {
105+
this.botEnabled = response.isEnabled;
106+
this.banKnownBots = response.banKnownBots;
107+
},
108+
error: err => console.error(err)
109+
});
89110
},
90111
error: (_: HttpErrorResponse) => {
91112
this.onLoginFailed();
@@ -97,27 +118,6 @@ export class TwitchBotConfigComponent implements OnInit, OnDestroy {
97118
// make this unnecessary.
98119
const url = this.router.createUrlTree([], {relativeTo: this.route}).toString();
99120
this.location.go(url);
100-
101-
// Check if the bot account is modded. If it isn't, we can offer to mod it.
102-
this.twitchBotApi.getIsMod().subscribe({
103-
next: response => {
104-
this.botIsMod = response.isMod;
105-
},
106-
error: err => {
107-
this.botIsMod = false;
108-
this.error = 'Unable to determine if nullinside is a mod in your channel';
109-
console.log(err);
110-
}
111-
});
112-
113-
// Get the person's existing configuration.
114-
this.twitchBotApi.getConfig().subscribe({
115-
next: response => {
116-
this.botEnabled = response.isEnabled;
117-
this.banKnownBots = response.banKnownBots;
118-
},
119-
error: err => console.error(err)
120-
});
121121
},
122122
error: (_: HttpErrorResponse) => {
123123
this.onLoginFailed();

0 commit comments

Comments
 (0)