From 518073e93cca209dd4946748436df3693e9494bb Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 17 May 2024 18:02:25 +0530 Subject: [PATCH] Removed: console statements, passed token as param in login call and removed isMarrgLogin param from url --- src/router/index.ts | 2 +- src/services/UserService.ts | 8 +++----- src/views/Settings.vue | 3 ++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 813677a..5238cfd 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -11,7 +11,7 @@ const authGuard = async (to: any, from: any, next: any) => { await loader.present('Authenticating') // TODO use authenticate() when support is there const redirectUrl = window.location.origin + '/login' - window.location.href = `${process.env.VUE_APP_LOGIN_URL}?redirectUrl=${redirectUrl}&isMaargLogin=true` + window.location.href = `${process.env.VUE_APP_LOGIN_URL}?redirectUrl=${redirectUrl}` loader.dismiss() } next() diff --git a/src/services/UserService.ts b/src/services/UserService.ts index dc1cd9b..4500e11 100644 --- a/src/services/UserService.ts +++ b/src/services/UserService.ts @@ -1,4 +1,4 @@ -import api, {client} from "@/api" +import api, { client } from "@/api" import store from "@/store"; import { hasError } from "@/utils"; @@ -6,12 +6,13 @@ const login = async (token: string): Promise => { const url = store.getters["user/getBaseUrl"] const baseURL = url.startsWith('http') ? url.includes('/rest/s1/order-routing') ? url : `${url}/rest/s1/order-routing/` : `https://${url}.hotwax.io/rest/s1/order-routing/`; let api_key = "" + try { const resp = await client({ url: "login", method: "post", baseURL, - data: { + params: { token }, headers: { @@ -19,8 +20,6 @@ const login = async (token: string): Promise => { } }) as any; - console.log('resp', resp) - if(!hasError(resp) && (resp.data.api_key || resp.data.token)) { api_key = resp.data.api_key || resp.data.token } else { @@ -29,7 +28,6 @@ const login = async (token: string): Promise => { } catch(err) { return Promise.reject("Sorry, login failed. Please try again"); } - console.log('api_key=========', api_key) return Promise.resolve(api_key) } diff --git a/src/views/Settings.vue b/src/views/Settings.vue index b4a37ea..0be5fd9 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -137,7 +137,8 @@ async function changeTimeZone() { function logout() { store.dispatch("user/logout").then(() => { - router.push("/login"); + const redirectUrl = window.location.origin + '/login' + window.location.href = `${process.env.VUE_APP_LOGIN_URL}?isLoggedOut=true&redirectUrl=${redirectUrl}` }) }