decord/beta/source/actions/ChangeVanityURLActionCreators.tsx
github-actions 84d017ff78 chore: update source for beta 348.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
2026-09-28 16:18:32 +00:00

56 lines
2.3 KiB
TypeScript

// Module ID: 17446
// Function ID: 17447
// Name: ChangeVanityURLActionCreators
// Dependencies: [1074, 573, 1271, 2]
// Module 17446 (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;
});
}
};