Skip to content

Commit

Permalink
フラッシュメッセージを実装しよう
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yoshiii committed Jul 19, 2022
1 parent 7053545 commit 7ee5719
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/views/LoginView.vue
Expand Up @@ -21,6 +21,15 @@
>LOGIN</v-btn
>
<v-btn @click="reset">CLEAR</v-btn>
<v-alert
dense
text
type="success"
class="success-message"
v-if="message"
>
{{ message }}
</v-alert>
</v-form>
</v-card>
</div>
Expand All @@ -37,7 +46,14 @@ export default {
(v) => /.+@.+\..+/.test(v) || "メールアドレスが不正です",
],
password: "",
message: "",
}),
mounted() {
if (localStorage.message) {
this.message = localStorage.message;
localStorage.message = "";
}
},
computed: {
isValid() {
console.log("isValid", this.valid);
Expand Down Expand Up @@ -73,4 +89,7 @@ export default {
.login-btn {
margin-right: 20px;
}
.success-message {
margin-top: 20px;
}
</style>
1 change: 1 addition & 0 deletions src/views/SignupView.vue
Expand Up @@ -90,6 +90,7 @@ export default {
displayName: this.name,
});
console.log("updateuser", this.user);
localStorage.message = "新規作成に成功しました";
this.$router.push("/login");
})
.catch((error) => {
Expand Down

0 comments on commit 7ee5719

Please sign in to comment.