Skip to content

Commit

Permalink
Implemented: button for navigating to launchpad and handled launchpad…
Browse files Browse the repository at this point in the history
… and app logout
  • Loading branch information
sanskar345 committed Aug 3, 2023
1 parent 420ffaa commit 1ceacd7
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"First name": "First name",
"Generate packing slips": "Generate packing slips",
"Go to OMS": "Go to OMS",
"Go to Launchpad": "Go to Launchpad",
"Handover": "Handover",
"Inactive store": "Inactive store",
"in stock": "in stock",
Expand Down
1 change: 1 addition & 0 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"First name": "Nombre",
"Generate packing slips": "Generar documentos de embalaje",
"Go to OMS": "Ir a OMS",
"Go to Launchpad": "Go to Launchpad",
"Handover": "Entregar",
"Inactive store": "Tienda inactiva",
"in stock": "en stock",
Expand Down
1 change: 1 addition & 0 deletions src/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"First name": "",
"Generate packing slips": "内容明細票の作成",
"Go to OMS": "OMSへ",
"Go to Launchpad": "Go to Launchpad",
"Handover": "引き継ぐ",
"Inactive store": "休止店舗",
"in stock": "在庫あり",
Expand Down
13 changes: 12 additions & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ const authGuard = async (to: any, from: any, next: any) => {
next()
};

const loginGuard = (to: any, from: any, next: any) => {
const authStore = useAuthStore()
if (authStore.isAuthenticated) {
// if route has token and oms do the login flow processing
if (to.query?.token && to.query?.oms) next()
else next('/')
}
next();
};

const routes: Array<RouteRecordRaw> = [
{
path: '/',
Expand Down Expand Up @@ -74,7 +84,8 @@ const routes: Array<RouteRecordRaw> = [
{
path: '/login',
name: 'Login',
component: Login
component: Login,
beforeEnter: loginGuard
},
{
path: "/orderdetail/:orderId/:orderPartSeqId",
Expand Down
17 changes: 14 additions & 3 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@
<ion-avatar slot="start" v-if="userProfile?.partyImageUrl">
<Image :src="userProfile.partyImageUrl"/>
</ion-avatar>
<ion-card-header>
<!-- ion-no-padding to remove extra side/horizontal padding as additional padding
is added on sides from ion-item and ion-padding-vertical to compensate the removed
vertical padding -->
<ion-card-header class="ion-no-padding ion-padding-vertical">
<ion-card-subtitle>{{ userProfile?.userLoginId }}</ion-card-subtitle>
<ion-card-title>{{ userProfile?.partyName }}</ion-card-title>
</ion-card-header>
</ion-item>
<ion-button fill="outline" color="danger" @click="logout()">{{ $t("Logout") }}</ion-button>
<ion-button color="danger" @click="logout()">{{ $t("Logout") }}</ion-button>
<ion-button fill="outline" @click="goToLaunchpad()">
{{ $t("Go to Launchpad") }}
<ion-icon slot="end" :icon="openOutline" />
</ion-button>
<!-- Commenting this code as we currently do not have reset password functionality -->
<!-- <ion-button fill="outline" color="medium">{{ $t("Reset password") }}</ion-button> -->
</ion-card>
Expand Down Expand Up @@ -290,9 +297,13 @@ export default defineComponent({
},
logout () {
this.store.dispatch('user/logout').then(() => {
window.location.href = process.env.VUE_APP_LOGIN_URL as string
const redirectUrl = window.location.origin + '/login'
window.location.href = `${process.env.VUE_APP_LOGIN_URL}?isLoggedOut=true&redirectUrl=${redirectUrl}`
})
},
goToLaunchpad() {
window.location.href = `${process.env.VUE_APP_LOGIN_URL}`
},
setShowShippingOrdersPreference (ev: any) {
this.store.dispatch('user/setUserPreference', { showShippingOrders: ev.detail.checked })
},
Expand Down

0 comments on commit 1ceacd7

Please sign in to comment.