Skip to content

Commit 85cb5a3

Browse files
prateekj117abhinavk96
authored andcommitted
feat: Add adapter for access codes to fetch them by event ID (#3325)
* Add adapter for access-code * Correct Url in ticket-list
1 parent b5d3e8d commit 85cb5a3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

app/adapters/access-code.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import ApplicationAdapter from './application';
2+
import ENV from 'open-event-frontend/config/environment';
3+
4+
export default ApplicationAdapter.extend({
5+
6+
urlForQueryRecord(query) {
7+
if (query && query.code && query.eventIdentifier) {
8+
return `${ENV.APP.apiHost}/v1/events/${query.eventIdentifier}/access-codes/${query.code}`;
9+
} else {
10+
return this._super(...arguments);
11+
}
12+
}
13+
});

app/components/public/ticket-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default Component.extend(FormMixin, {
110110
this.set('code', this.promotionalCode);
111111
}
112112
try {
113-
let accessCode = await this.store.findRecord('access-code', this.promotionalCode, {});
113+
let accessCode = await this.store.queryRecord('access-code', { eventIdentifier: this.event.id, code: this.promotionalCode });
114114
this.order.set('accessCode', accessCode);
115115
let tickets = await accessCode.get('tickets');
116116
tickets.forEach(ticket => {

0 commit comments

Comments
 (0)