Skip to content

Commit

Permalink
Added accounts passthrough views so more account functionality should…
Browse files Browse the repository at this point in the history
… work
  • Loading branch information
Jon committed Feb 2, 2024
1 parent f1147d2 commit e43c89e
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ocs-example-frontend",
"version": "0.1.1",
"version": "0.1.2",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
41 changes: 41 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import RequestgroupsList from "../views/RequestgroupsList.vue";
import Login from "../views/Login.vue";
import Register from '../views/Register.vue';
import Profile from "../views/Profile.vue";
import AccountsGet from '../views/AccountsGet.vue';
import AccountsForm from '../views/AccountsForm.vue';
import RequestgroupDetail from "../views/RequestgroupDetail.vue";
import Observations from "../views/Observations.vue";
import ObservationDetail from "../views/ObservationDetail.vue";
Expand Down Expand Up @@ -90,6 +92,45 @@ const routes = [
component: Register,
meta: {
title: 'Register for an account'
},
// if user is authenticated, redirect to homepage
beforeEnter (to, from, next) {
if (store.state.userIsAuthenticated) {
next('/');
}
else {
next();
}
}
},
{
path: '/accounts/password/reset/confirm/:id/set-password',
name: 'passwordResetConfirmSetPassword',
component: AccountsForm
},
{
path: '/accounts/password/reset/confirm/:id/:anotherId',
name: 'passwordResetConfirm',
component: AccountsGet,
props: {
successRedirectViewName: 'passwordResetConfirmSetPassword'
}
},
{
path: '/accounts/password/reset',
name: 'passwordReset',
component: AccountsForm
},
{
path: '/accounts/password/change',
name: 'passwordChange',
component: AccountsForm
},
{
path: '/accounts/*',
component: AccountsGet,
meta: {
title: 'Accounts'
}
},
{
Expand Down
30 changes: 30 additions & 0 deletions src/views/AccountsForm.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<template>
<b-row>
<b-col>
<passthrough-form :endpoint="endpoint" :success-redirect-view-name="successRedirectViewName" />
<br />
</b-col>
</b-row>
</template>
<script>
import PassthroughForm from '@/components/PassthroughForm.vue';
export default {
name: 'AccountsPassthroughFormPage',
components: {
PassthroughForm
},
props: {
successRedirectViewName: {
type: String,
default: ''
}
},
data: function() {
return {
endpoint: this.$route.path
};
}
};
</script>

Empty file added src/views/AccountsGet.vue
Empty file.

0 comments on commit e43c89e

Please sign in to comment.