Skip to content

Commit

Permalink
Add condition to not render the claim components if there's no connec…
Browse files Browse the repository at this point in the history
…ted account.
  • Loading branch information
asvinb committed Nov 5, 2024
1 parent 66de193 commit dacbd04
Showing 1 changed file with 44 additions and 41 deletions.
85 changes: 44 additions & 41 deletions js/src/components/google-mc-account-card/connect-mc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,49 +60,52 @@ const ConnectMC = ( { createAccount, resultCreateAccount, className } ) => {
}
}, [ googleMCAccount, isGoogleMCReady ] );

if ( resultConnectMC.response?.status === 409 ) {
return (
<SwitchUrlCard
id={ resultConnectMC.error.id }
message={ resultConnectMC.error.message }
claimedUrl={ resultConnectMC.error.claimed_url }
newUrl={ resultConnectMC.error.new_url }
onSelectAnotherAccount={ resultConnectMC.reset }
/>
);
}
if ( ! isGoogleMCReady ) {
if ( resultConnectMC.response?.status === 409 ) {
return (
<SwitchUrlCard
id={ resultConnectMC.error.id }
message={ resultConnectMC.error.message }
claimedUrl={ resultConnectMC.error.claimed_url }
newUrl={ resultConnectMC.error.new_url }
onSelectAnotherAccount={ resultConnectMC.reset }
/>
);
}

if (
resultConnectMC.response?.status === 403 ||
resultCreateAccount.response?.status === 403
) {
return (
<ReclaimUrlCard
id={
resultConnectMC.error?.id || resultCreateAccount.error?.id
}
websiteUrl={
resultConnectMC.error?.website_url ||
resultCreateAccount.error?.website_url
}
onSwitchAccount={ () => {
resultConnectMC.reset();
resultCreateAccount.reset();
} }
/>
);
}
if (
resultConnectMC.response?.status === 403 ||
resultCreateAccount.response?.status === 403
) {
return (
<ReclaimUrlCard
id={
resultConnectMC.error?.id ||
resultCreateAccount.error?.id
}
websiteUrl={
resultConnectMC.error?.website_url ||
resultCreateAccount.error?.website_url
}
onSwitchAccount={ () => {
resultConnectMC.reset();
resultCreateAccount.reset();
} }
/>
);
}

if (
resultCreateAccount.loading ||
resultCreateAccount.response?.status === 503
) {
return (
<CreatingCard
retryAfter={ resultCreateAccount.error?.retry_after }
onRetry={ createAccount }
/>
);
if (
resultCreateAccount.loading ||
resultCreateAccount.response?.status === 503
) {
return (
<CreatingCard
retryAfter={ resultCreateAccount.error?.retry_after }
onRetry={ createAccount }
/>
);
}
}

const getIndicator = () => {
Expand Down

0 comments on commit dacbd04

Please sign in to comment.