mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 09:57:25 +08:00
DEV: introduces prettier for es6 files
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
import AdminUser from 'admin/models/admin-user';
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
import AdminUser from "admin/models/admin-user";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
const ApiKey = Discourse.Model.extend({
|
||||
|
||||
/**
|
||||
Regenerates the api key
|
||||
|
||||
@ -11,8 +10,11 @@ const ApiKey = Discourse.Model.extend({
|
||||
**/
|
||||
regenerate: function() {
|
||||
var self = this;
|
||||
return ajax('/admin/api/key', {type: 'PUT', data: {id: this.get('id')}}).then(function (result) {
|
||||
self.set('key', result.api_key.key);
|
||||
return ajax("/admin/api/key", {
|
||||
type: "PUT",
|
||||
data: { id: this.get("id") }
|
||||
}).then(function(result) {
|
||||
self.set("key", result.api_key.key);
|
||||
return self;
|
||||
});
|
||||
},
|
||||
@ -24,13 +26,14 @@ const ApiKey = Discourse.Model.extend({
|
||||
@returns {Promise} a promise that resolves when the key has been revoked
|
||||
**/
|
||||
revoke: function() {
|
||||
return ajax('/admin/api/key', {type: 'DELETE', data: {id: this.get('id')}});
|
||||
return ajax("/admin/api/key", {
|
||||
type: "DELETE",
|
||||
data: { id: this.get("id") }
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ApiKey.reopenClass({
|
||||
|
||||
/**
|
||||
Creates an API key instance with internal user object
|
||||
|
||||
@ -54,7 +57,7 @@ ApiKey.reopenClass({
|
||||
**/
|
||||
find: function() {
|
||||
return ajax("/admin/api/keys").then(function(keys) {
|
||||
return keys.map(function (key) {
|
||||
return keys.map(function(key) {
|
||||
return ApiKey.create(key);
|
||||
});
|
||||
});
|
||||
@ -67,11 +70,10 @@ ApiKey.reopenClass({
|
||||
@returns {Promise} a promise that resolves to a master `ApiKey`
|
||||
**/
|
||||
generateMasterKey: function() {
|
||||
return ajax("/admin/api/key", {type: 'POST'}).then(function (result) {
|
||||
return ajax("/admin/api/key", { type: "POST" }).then(function(result) {
|
||||
return ApiKey.create(result.api_key);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
export default ApiKey;
|
||||
|
Reference in New Issue
Block a user