Handle 409/410 when confirming username
This commit is contained in:
parent
10885e5d3f
commit
486ada8b6c
8 changed files with 106 additions and 15 deletions
|
@ -120,7 +120,10 @@ export function EditUsernameModalBody({
|
|||
return i18n('ProfileEditor--username--unavailable');
|
||||
}
|
||||
// Displayed through confirmation modal below
|
||||
if (error === UsernameReservationError.General) {
|
||||
if (
|
||||
error === UsernameReservationError.General ||
|
||||
error === UsernameReservationError.ConflictOrGone
|
||||
) {
|
||||
return;
|
||||
}
|
||||
throw missingCaseError(error);
|
||||
|
@ -264,6 +267,24 @@ export function EditUsernameModalBody({
|
|||
{i18n('ProfileEditor--username--general-error')}
|
||||
</ConfirmationDialog>
|
||||
)}
|
||||
|
||||
{error === UsernameReservationError.ConflictOrGone && (
|
||||
<ConfirmationDialog
|
||||
dialogName="EditUsernameModalBody.conflictOrGone"
|
||||
cancelText={i18n('ok')}
|
||||
cancelButtonVariant={ButtonVariant.Secondary}
|
||||
i18n={i18n}
|
||||
onClose={() => {
|
||||
if (nickname) {
|
||||
reserveUsername(nickname);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{i18n('icu:ProfileEditor--username--reservation-gone', {
|
||||
username: currentUsername,
|
||||
})}
|
||||
</ConfirmationDialog>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue