-
Notifications
You must be signed in to change notification settings - Fork 825
Open
Labels
bugSomething isn't workingSomething isn't working
Description
| return !!this.store.trips.destroy({ where: { userId, launchId } }); |
Due to this line cancelTrip throws an error.
{
"errors": [
{
"message": "Cannot read property 'flight_number' of undefined",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"cancelTrip"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"TypeError: Cannot read property 'flight_number' of undefined",
// ....Following change will fix the error.
async cancelTrip({ launchId }) {
const userId = this.context.user.id;
const numberOfDeletedTrips = await this.store.trips.destroy({ where: { userId, launchId } });
return numberOfDeletedTrips !== 0;
}
As per the doc of destroy it returns number of deleted resources wrapped in Promise. So it should be resolved to get the count to decide if resources are deleted or not.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working