Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4941.js (118.4 MB)
56 lines
2.3 KiB
TypeScript
56 lines
2.3 KiB
TypeScript
// Module ID: 18069
|
|
// Function ID: 18070
|
|
// Name: ChangeVanityURLActionCreators
|
|
// Dependencies: [1074, 573, 1271, 2]
|
|
|
|
// Module 18069 (ChangeVanityURLActionCreators)
|
|
import DispatcherDefault from "Dispatcher" /* 573 */;
|
|
import Constants from "Constants" /* 1074 */;
|
|
import HTTPUtils from "HTTPUtils" /* 1271 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const Endpoints = Constants.Endpoints;
|
|
const result = size.fileFinishedImporting("actions/ChangeVanityURLActionCreators.tsx");
|
|
|
|
export default {
|
|
openModal(id, vanityURLCode) {
|
|
DispatcherDefault.dispatch({ type: "CHANGE_VANITY_URL_MODAL_OPEN", guildId: id, code: vanityURLCode });
|
|
},
|
|
closeModal() {
|
|
DispatcherDefault.dispatch({ type: "CHANGE_VANITY_URL_MODAL_CLOSE" });
|
|
},
|
|
removeVanityURL(id) {
|
|
const HTTP = HTTPUtils.HTTP;
|
|
const request = { url: Endpoints.GUILD_VANITY_URL(id), body: { code: null }, oldFormErrors: true, rejectWithError: true };
|
|
return HTTP.patch(request).then(() => {
|
|
DispatcherDefault.dispatch({ type: "GUILD_SETTINGS_SET_VANITY_URL", code: null, uses: 0 });
|
|
});
|
|
},
|
|
changeVanityURL(id, vanityURLCode) {
|
|
const self = this;
|
|
DispatcherDefault.dispatch({ type: "CHANGE_VANITY_URL_MODAL_SUBMIT" });
|
|
const HTTP = self(1271).HTTP;
|
|
const request = { url: Endpoints.GUILD_VANITY_URL(id), body: { code: vanityURLCode }, oldFormErrors: true, rejectWithError: true };
|
|
const obj2 = { code: vanityURLCode };
|
|
return HTTP.patch(request).then((body) => {
|
|
({ code, uses } = body.body);
|
|
DispatcherDefault.dispatch({ type: "GUILD_SETTINGS_SET_VANITY_URL", code, uses });
|
|
self.closeModal();
|
|
}, (body) => {
|
|
DispatcherDefault.dispatch({ type: "CHANGE_VANITY_URL_MODAL_SUBMIT_FAILURE", error: body.body, hasError: true });
|
|
return body;
|
|
});
|
|
},
|
|
setVanityURL(id, code) {
|
|
const HTTP = HTTPUtils.HTTP;
|
|
const request = { url: Endpoints.GUILD_VANITY_URL(id), body: { code }, oldFormErrors: true, rejectWithError: HTTPUtils.rejectWithMigratedError() };
|
|
const obj = { code };
|
|
return HTTP.patch(request).then((body) => {
|
|
({ code, uses } = body.body);
|
|
DispatcherDefault.dispatch({ type: "GUILD_SETTINGS_SET_VANITY_URL", code, uses });
|
|
}, (body) => {
|
|
DispatcherDefault.dispatch({ type: "CHANGE_VANITY_URL_MODAL_SUBMIT_FAILURE", error: body.body, hasError: true });
|
|
return body;
|
|
});
|
|
}
|
|
};
|