1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/initializers/trailing-hash.js
Kevin Ansfield d4faa15f46 Upgrade eslint dependencies (#855)
no issue

- bump ember-cli-eslint and eslint-plugin-ember
- fix indentation & "unnecessary escape chars" lint errors
2017-09-11 14:56:11 +07:00

22 lines
503 B
JavaScript

import HashLocation from '@ember/routing/hash-location';
let trailingHash = HashLocation.extend({
formatURL() {
let url = this._super(...arguments);
if (url.indexOf('?') > 0) {
return url.replace(/([^/])\?/, '$1/?');
} else {
return url.replace(/\/?$/, '/');
}
}
});
export default {
name: 'registerTrailingHashLocation',
initialize(application) {
application.register('location:trailing-hash', trailingHash);
}
};