1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-22 16:03:25 +00:00

Redirect from Login page to Homepage if already logged-in

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-08-09 08:59:46 +02:00
parent 16f90254a0
commit bfc9dd7ea3
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -118,7 +118,7 @@
</template>
<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
import { Route } from "vue-router";
import { ICurrentUser } from "@/types/current-user.model";
import { LoginError, LoginErrorCode } from "@/types/enums";
@ -269,6 +269,13 @@ export default class Login extends Vue {
}
}
}
@Watch("currentUser")
redirectToHomepageIfAlreadyLoggedIn(): Promise<Route> | void {
if (this.currentUser.isLoggedIn) {
return this.$router.push("/");
}
}
}
</script>