4bcb45d0bb
poll id was not set as part of url afterwards; add tests to not let this happen again
31 lines
673 B
JavaScript
31 lines
673 B
JavaScript
import Ember from 'ember';
|
|
|
|
export default Ember.Route.extend({
|
|
actions: {
|
|
error(error) {
|
|
if (error && error.status === 404) {
|
|
return this.transitionTo('404');
|
|
}
|
|
|
|
return true;
|
|
}
|
|
},
|
|
|
|
encryption: Ember.inject.service(),
|
|
|
|
model(params) {
|
|
// get encryption key from query parameter in singleton
|
|
// before it's used by serializer to decrypt payload
|
|
this.set('encryption.key', params.encryptionKey);
|
|
|
|
return this.store.find('poll', params.poll_id);
|
|
},
|
|
|
|
redirect(poll) {
|
|
this.transitionTo('poll.participation', poll, {
|
|
queryParams: {
|
|
encryptionKey: this.get('encryption.key')
|
|
}
|
|
});
|
|
}
|
|
});
|