Fixed unnecessary relinking Twitch account when logging in on Twitch page.
This commit is contained in:
parent
6d3fee36ec
commit
a8afe80153
|
@ -42,6 +42,7 @@ export async function linkTwitchAccountRedirect(
|
||||||
const [twitchAuthURL] = await initLinkTwitchAccount(user.id, apiKey)
|
const [twitchAuthURL] = await initLinkTwitchAccount(user.id, apiKey)
|
||||||
|
|
||||||
window.location.href = twitchAuthURL
|
window.location.href = twitchAuthURL
|
||||||
|
await new Promise((r) => setTimeout(r, 1e10)) // Wait "forever" for the page to change location
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateBotEnabledForUser(
|
export async function updateBotEnabledForUser(
|
||||||
|
|
|
@ -51,6 +51,8 @@ function ButtonGetStarted(props: {
|
||||||
const { user, privateUser } = await getUserAndPrivateUser(userId)
|
const { user, privateUser } = await getUserAndPrivateUser(userId)
|
||||||
if (!user || !privateUser) return
|
if (!user || !privateUser) return
|
||||||
|
|
||||||
|
if (privateUser.twitchInfo?.twitchName) return // If we've already linked Twitch, no need to do so again
|
||||||
|
|
||||||
await linkTwitchAccountRedirect(user, privateUser)
|
await linkTwitchAccountRedirect(user, privateUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +66,7 @@ function ButtonGetStarted(props: {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
toast.error('Failed to sign up. Please try again later.')
|
toast.error('Failed to sign up. Please try again later.')
|
||||||
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,7 +350,9 @@ function SetUpBot(props: {
|
||||||
<div className="flex flex-col gap-6 sm:flex-row">
|
<div className="flex flex-col gap-6 sm:flex-row">
|
||||||
<BotSetupStep
|
<BotSetupStep
|
||||||
stepNum={1}
|
stepNum={1}
|
||||||
overrideButton={<BotConnectButton privateUser={privateUser} />}
|
overrideButton={
|
||||||
|
twitchLinked && <BotConnectButton privateUser={privateUser} />
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Use the button above to add the bot to your channel. Then mod it by
|
Use the button above to add the bot to your channel. Then mod it by
|
||||||
typing in your Twitch chat: <b>/mod ManifoldBot</b>
|
typing in your Twitch chat: <b>/mod ManifoldBot</b>
|
||||||
|
@ -399,7 +404,7 @@ export default function TwitchLandingPage() {
|
||||||
<Col className="max-w-3xl gap-8 rounded bg-white p-4 text-gray-600 shadow-md sm:mx-auto sm:p-10">
|
<Col className="max-w-3xl gap-8 rounded bg-white p-4 text-gray-600 shadow-md sm:mx-auto sm:p-10">
|
||||||
<TwitchPlaysManifoldMarkets user={user} privateUser={privateUser} />
|
<TwitchPlaysManifoldMarkets user={user} privateUser={privateUser} />
|
||||||
<TwitchChatCommands />
|
<TwitchChatCommands />
|
||||||
<SetUpBot privateUser={privateUser} />
|
<SetUpBot user={user} privateUser={privateUser} />
|
||||||
</Col>
|
</Col>
|
||||||
</Page>
|
</Page>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user