pixelfed/public/js/developers.js

1 line
23 KiB
JavaScript
Raw Normal View History

2022-03-31 06:22:49 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[822],{73739:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>a});const a={data:function(){return{tokens:[]}},ready:function(){this.prepareComponent()},mounted:function(){this.prepareComponent()},methods:{prepareComponent:function(){this.getTokens()},getTokens:function(){var t=this;axios.get("/oauth/tokens").then((function(e){t.tokens=e.data}))},revoke:function(t){var e=this;axios.delete("/oauth/tokens/"+t.id).then((function(t){e.getTokens()}))}}}},20204:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>o});var a=s(19755);function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}const o={data:function(){return{clients:[],createForm:{errors:[],name:"",redirect:""},editForm:{errors:[],name:"",redirect:""}}},ready:function(){this.prepareComponent()},mounted:function(){this.prepareComponent()},methods:{prepareComponent:function(){this.getClients(),a("#modal-create-client").on("shown.bs.modal",(function(){a("#create-client-name").focus()})),a("#modal-edit-client").on("shown.bs.modal",(function(){a("#edit-client-name").focus()}))},getClients:function(){var t=this;axios.get("/oauth/clients").then((function(e){t.clients=e.data}))},showCreateClientForm:function(){a("#modal-create-client").modal("show")},store:function(){this.persistClient("post","/oauth/clients",this.createForm,"#modal-create-client")},edit:function(t){this.editForm.id=t.id,this.editForm.name=t.name,this.editForm.redirect=t.redirect,a("#modal-edit-client").modal("show")},update:function(){this.persistClient("put","/oauth/clients/"+this.editForm.id,this.editForm,"#modal-edit-client")},persistClient:function(t,e,s,o){var r=this;s.errors=[],axios[t](e,s).then((function(t){r.getClients(),s.name="",s.redirect="",s.errors=[],a(o).modal("hide")})).catch((function(t){"object"===n(t.response.data)?s.errors=_.flatten(_.toArray(t.response.data.errors)):s.errors=["Something went wrong. Please try again."]}))},destroy:function(t){var e=this;axios.delete("/oauth/clients/"+t.id).then((function(t){e.getClients()}))}}}},31518:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>o});var a=s(19755);function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}const o={data:function(){return{accessToken:null,tokens:[],scopes:[],form:{name:"",scopes:[],errors:[]}}},ready:function(){this.prepareComponent()},mounted:function(){this.prepareComponent()},methods:{prepareComponent:function(){this.getTokens(),this.getScopes(),a("#modal-create-token").on("shown.bs.modal",(function(){a("#create-token-name").focus()}))},getTokens:function(){var t=this;axios.get("/oauth/personal-access-tokens").then((function(e){t.tokens=e.data}))},getScopes:function(){var t=this;axios.get("/oauth/scopes").then((function(e){t.scopes=e.data}))},showCreateTokenForm:function(){a("#modal-create-token").modal("show")},store:function(){var t=this;this.accessToken=null,this.form.errors=[],axios.post("/oauth/personal-access-tokens",this.form).then((function(e){t.form.name="",t.form.scopes=[],t.form.errors=[],t.tokens.push(e.data.token),t.showAccessToken(e.data.accessToken)})).catch((function(e){"object"===n(e.response.data)?t.form.errors=_.flatten(_.toArray(e.response.data.errors)):t.form.errors=["Something went wrong. Please try again."]}))},toggleScope:function(t){this.scopeIsAssigned(t)?this.form.scopes=_.reject(this.form.scopes,(function(e){return e==t})):this.form.scopes.push(t)},scopeIsAssigned:function(t){return _.indexOf(this.form.scopes,t)>=0},showAccessToken:function(t){a("#modal-create-token").modal("hide"),this.accessToken=t,a("#modal-access-token").modal("show")},revoke:function(t){var e=this;axios.delete("/oauth/personal-access-tokens/"+t.id).then((function(t){e.getTokens()}))}}}},89831:(t,e,s)=>{Vue.component("p