Skip to content

Commit de70b3e

Browse files
Get passenger info from claims
1 parent 7f15147 commit de70b3e

File tree

2 files changed

+30
-32
lines changed

2 files changed

+30
-32
lines changed

scripts/run-local.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ try {
1212
# cd /dotnet
1313
Push-Location ( Join-Path $PSScriptRoot ../dotnet )
1414

15-
# Build and host SPA at http://127.0.0.1:8080/
15+
# Build and host SPA at http://127.0.0.1:4280/
1616
Start-Process pwsh { -c cd ../web/serverless-microservices-web && npm install && copy ../../test/settings.example.js ./public/js/settings.js && npm run serve -- --port 4280 }
1717

1818
# Build and start Trip Archiver Nodejs Function

web/serverless-microservices-web/src/views/Trip.vue

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -314,46 +314,44 @@ export default {
314314
);
315315
})
316316
.catch(err => {
317+
console.error(err)
317318
this.$toast.error(
318-
err.response ? err.response : err.message ? err.message : err,
319+
err.response ? err.response.data : err.message ? err.message : err,
319320
"Error",
320321
this.notificationSystem.options.error
321322
);
322323
});
323324
},
324325
requestDriver() {
325326
if (this.user) {
326-
getPassenger(this.user.idTokenClaims.oid)
327-
.then(response => {
328-
this.passengerInfo = response.data;
327+
if (this.user.idTokenClaims === undefined || this.user.idTokenClaims.emails === undefined || this.user.idTokenClaims.emails.length == 0) {
328+
console.error("this.user.idTokenClaims.emails is not present or does not contain any emails. Please check user claims and permissions.")
329+
this.$toast.error(
330+
"User's email not found",
331+
"Error",
332+
this.notificationSystem.options.error
333+
);
334+
}
329335
330-
var trip = {
331-
passenger: {
332-
code: this.passengerInfo.email,
333-
firstName: this.passengerInfo.givenName,
334-
surname: this.passengerInfo.surname,
335-
//"mobileNumber": this.passengerInfo.mobileNumber,
336-
email: this.passengerInfo.givenName
337-
},
338-
source: {
339-
latitude: this.selectedPickUpLocation.latitude,
340-
longitude: this.selectedPickUpLocation.longitude
341-
},
342-
destination: {
343-
latitude: this.selectedDestinationLocation.latitude,
344-
longitude: this.selectedDestinationLocation.longitude
345-
},
346-
type: 1 //0 = Normal, 1 = Demo
347-
};
348-
this.createTripRequest(trip);
349-
})
350-
.catch(err => {
351-
this.$toast.error(
352-
err.response,
353-
"Error",
354-
this.notificationSystem.options.error
355-
);
356-
});
336+
var trip = {
337+
passenger: {
338+
code: this.user.idTokenClaims.emails[0],
339+
firstName: this.user.idTokenClaims.given_name,
340+
surname: this.user.idTokenClaims.family_name,
341+
//"mobileNumber": this.passengerInfo.mobileNumber,
342+
email: this.user.idTokenClaims.emails[0]
343+
},
344+
source: {
345+
latitude: this.selectedPickUpLocation.latitude,
346+
longitude: this.selectedPickUpLocation.longitude
347+
},
348+
destination: {
349+
latitude: this.selectedDestinationLocation.latitude,
350+
longitude: this.selectedDestinationLocation.longitude
351+
},
352+
type: 1 //0 = Normal, 1 = Demo
353+
};
354+
this.createTripRequest(trip);
357355
} else {
358356
this.$toast.error(
359357
"You must be logged in to start a new trip!",

0 commit comments

Comments
 (0)