Minor - add redirects to login page

pull/3890/head
Julio Montoya 5 years ago
parent 7ca17d5a96
commit d97ddc6b8f
  1. 4
      assets/vue/components/Login.vue
  2. 6
      assets/vue/pages/Index.vue
  3. 13
      assets/vue/pages/Login.vue

@ -82,7 +82,7 @@ export default {
if (typeof redirect !== "undefined") { if (typeof redirect !== "undefined") {
router.push({path: redirect}); router.push({path: redirect});
} else { } else {
router.push({path: "/"}); router.push({path: "/home"});
} }
} }
@ -103,7 +103,7 @@ export default {
if (typeof redirect !== "undefined") { if (typeof redirect !== "undefined") {
router.push({path: redirect}); router.push({path: redirect});
} else { } else {
router.push({path: "/courses"}); router.push({path: "/home"});
} }
} }
} }

@ -18,11 +18,11 @@
<div class="grid grid-cols-1 md:grid-cols-2"> <div class="grid grid-cols-1 md:grid-cols-2">
<!-- Form--> <!-- Form-->
<div class="md:row-start-1 md:col-start-2 md:col-end-2 p-12"> <div class="md:row-start-1 md:col-start-2 md:col-end-2 xl:p-12">
<div class="mt-10 lg:mt-16 flex justify-center"> <div class="md:mt-10 lg:mt-16 flex justify-center">
<div class="max-w-sm"> <div class="max-w-sm">
<div> <div>
<h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900"> <h2 class="text-center text-3xl font-extrabold text-gray-900">
Sign in Sign in
</h2> </h2>
</div> </div>

@ -13,11 +13,20 @@
<script> <script>
import Login from '../components/Login'; import Login from '../components/Login';
import {useRouter} from "vue-router";
import {useStore} from "vuex";
export default { export default {
components: { components: {
Login Login
}, },
name: "LoginPage" name: "LoginPage",
setup() {
const router = useRouter();
const store = useStore();
// If user is already logged in redirect to home.
if (store.getters["security/isAuthenticated"]) {
router.push({path: "/home"});
}
}
} }
</script> </script>
Loading…
Cancel
Save