97605ec7d7
* get deprecation workflow up to date * fix routing.transition-methods deprecation * fix this-property-fallback deprecation * fix implicit-injections deprecation * argument-less-helper-paren-less-invocation * remove unmaintained ember-transition-helper which triggers deprecated-run-loop-and-computed-dot-access deprecation * reset to only log but not throw on errors to not block other development * reset double quote to single quote changes in templates and fix Prettier config * fix JS linting * ugprade ember-template-lint to fix parser
36 lines
877 B
JavaScript
36 lines
877 B
JavaScript
import Route from '@ember/routing/route';
|
|
import { action } from '@ember/object';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default class PollRoute extends Route {
|
|
@service encryption;
|
|
@service router;
|
|
@service store;
|
|
|
|
@action
|
|
error(error) {
|
|
if (error && error.status === 404) {
|
|
return this.router.transitionTo('404');
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
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, transition) {
|
|
if (transition.targetName === 'poll.index') {
|
|
this.router.transitionTo('poll.participation', poll, {
|
|
queryParams: {
|
|
encryptionKey: this.encryption.key,
|
|
},
|
|
});
|
|
}
|
|
}
|
|
}
|