mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 11:22:19 +03:00
85cce39af7
refs https://github.com/TryGhost/Team/issues/1734 refs https://github.com/TryGhost/Team/issues/559 refs https://github.com/TryGhost/Ghost/issues/14101 - switches to newer modal patterns ready for later Ember upgrades - cleaned up the `upload-image` modal which had multiple areas of code that were no longer being used - disabled `no-duplicate-landmark-elements` template lint rule as it's buggy and mostly gives false positives
24 lines
688 B
JavaScript
24 lines
688 B
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class RegenerateStaffTokenModal extends Component {
|
|
@service ajax;
|
|
@service ghostPaths;
|
|
@service notifications;
|
|
|
|
@action
|
|
async regenerateStaffToken() {
|
|
const url = this.ghostPaths.url.api('users', 'me', 'token');
|
|
|
|
try {
|
|
const {apiKey} = await this.ajax.put(url, {data: {}});
|
|
|
|
this.args.close(`${apiKey.id}:${apiKey.secret}`);
|
|
} catch (error) {
|
|
this.notifications.showAPIError(error, {key: 'token.regenerate'});
|
|
this.args.close();
|
|
}
|
|
}
|
|
}
|