Skip to content

Commit 92634e8

Browse files
committed
fix X and skip button on error
Handles youtube sync errors by navigating the user back to the youtube sync page with a reset scroll parameter, and removes the button that takes the user to rewards page when the auth error occurs. This allows the user to retry the sync process more easily.
1 parent 347af28 commit 92634e8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ui/component/header/view.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ const Header = (props: Props) => {
105105

106106
const urlParams = new URLSearchParams(search);
107107
const returnPath = urlParams.get('redirect');
108+
const isYoutubeAuthErrorPage =
109+
iYTSyncPage && (urlParams.get('error') === 'true' || Boolean(urlParams.get('error_message')));
108110

109111
// For pages that allow for "backing out", shows a backout option instead of the Home logo
110112
const canBackout = Boolean(backout);
@@ -314,6 +316,11 @@ const Header = (props: Props) => {
314316
// className="button--header-close"
315317
icon={ICONS.REMOVE}
316318
onClick={() => {
319+
if (isYoutubeAuthErrorPage) {
320+
push(`/$/${PAGES.YOUTUBE_SYNC}?reset_scroll=youtube`);
321+
return;
322+
}
323+
317324
if (!iYTSyncPage && !isPwdResetPage) {
318325
clearEmailEntry();
319326
clearPasswordEntry();

ui/page/youtubeSync/view.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,13 @@ export default function YoutubeSync(props: Props) {
208208
<Button button="link" label={__('Skip')} onClick={() => doToggleInterestedInYoutubeSync()} />
209209
)}
210210

211-
{hasYoutubeAuthError && <Button button="link" label={__('Skip')} navigate={`/$/${PAGES.REWARDS}`} />}
211+
{hasYoutubeAuthError && (
212+
<Button
213+
button="link"
214+
label={__('Skip')}
215+
navigate={`/$/${PAGES.YOUTUBE_SYNC}?reset_scroll=youtube`}
216+
/>
217+
)}
212218
</div>
213219
<div className="help--card-actions">
214220
<I18nMessage

0 commit comments

Comments
 (0)