Skip to content

Commit

Permalink
Removed: console statements, passed token as param in login call and …
Browse files Browse the repository at this point in the history
…removed isMarrgLogin param from url
  • Loading branch information
ymaheshwari1 committed May 17, 2024
1 parent bd681b9 commit 518073e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 3 additions & 5 deletions src/services/UserService.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import api, {client} from "@/api"
import api, { client } from "@/api"
import store from "@/store";
import { hasError } from "@/utils";

const login = async (token: string): Promise <any> => {
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: {
"Content-Type": "application/json"
}
}) 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 {
Expand All @@ -29,7 +28,6 @@ const login = async (token: string): Promise <any> => {
} catch(err) {
return Promise.reject("Sorry, login failed. Please try again");
}
console.log('api_key=========', api_key)
return Promise.resolve(api_key)
}

Expand Down
3 changes: 2 additions & 1 deletion src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
})
}
Expand Down

0 comments on commit 518073e

Please sign in to comment.