2014-10-30 21:44:22 +01:00
|
|
|
import Ember from "ember";
|
|
|
|
|
2015-11-02 23:02:59 +01:00
|
|
|
export default Ember.Route.extend({
|
2014-10-28 06:00:37 +01:00
|
|
|
actions: {
|
2014-10-30 21:44:22 +01:00
|
|
|
error: function(error) {
|
2014-10-28 06:00:37 +01:00
|
|
|
if (error && error.status === 404) {
|
|
|
|
return this.transitionTo('404');
|
|
|
|
}
|
2015-11-02 23:02:59 +01:00
|
|
|
|
2014-10-28 06:00:37 +01:00
|
|
|
return true;
|
|
|
|
}
|
2015-08-19 22:00:01 +02:00
|
|
|
},
|
|
|
|
|
2015-11-02 23:02:59 +01:00
|
|
|
afterModel(poll) {
|
|
|
|
this.transitionTo('poll.participation', poll, {queryParams: {encryptionKey: this.get('encryption.key')}});
|
|
|
|
},
|
|
|
|
|
2015-10-25 19:38:14 +01:00
|
|
|
encryption: Ember.inject.service(),
|
|
|
|
|
2015-08-19 22:00:01 +02:00
|
|
|
model: function(params) {
|
|
|
|
// get encryption key from query parameter in singleton
|
|
|
|
// before it's used by serializer to decrypt payload
|
|
|
|
this.set('encryption.key', params.encryptionKey);
|
2015-11-02 23:02:59 +01:00
|
|
|
|
2015-08-19 22:00:01 +02:00
|
|
|
return this.store.find('poll', params.poll_id);
|
2014-10-28 06:00:37 +01:00
|
|
|
}
|
2015-08-19 22:00:01 +02:00
|
|
|
});
|