handle already_in_team error properly

This commit is contained in:
Riku Rouvila
2020-01-13 19:26:09 +02:00
parent 22eb942ce7
commit d4411b4579
2 changed files with 18 additions and 5 deletions

View File

@@ -74,15 +74,26 @@ export default class InviteForm extends React.Component {
if (this.state.submitted) {
messageText = "Kutsu lähetetty antamaasi sähköpostiosoitteeseen.";
} else if (
this.state.error.status === 400 &&
this.state.error.data === "invalid_email"
this.state.error.response.status === 400 &&
this.state.error.response.data === "invalid_email"
) {
messageText = "Tarkasta syöttämäsi sähköpostiosoite";
} else if (
this.state.error.status === 400 &&
this.state.error.data === "already_invited"
this.state.error.response.status === 400 &&
this.state.error.response.data === "already_invited"
) {
messageText = "Sähköpostiosoitteeseen on jo lähetetty kutsu";
} else if (
this.state.error.response.status === 400 &&
this.state.error.response.data === "already_in_team"
) {
messageText = (
<span>
Tällä sähköpostilla on jo luotu tunnus. <br /> Voit vaihtaa
unohtuneen salasanasi{" "}
<a href="https://koodiklinikka.slack.com/forgot">täältä</a>.
</span>
);
} else {
messageText = "Jotain meni pieleen. Yritä hetken päästä uudelleen.";
}

View File

@@ -214,7 +214,9 @@ section:first-child
transform rotateX(0deg)
transform-origin 100% 0
animation drop 0.6s linear
a
color #fff
font-weight bold
.form.has-error
.form--message
background rgb(226, 33, 112)