decord/stable/source/actions/ChangeVanityURLActionCreators.tsx
github-actions 528a3dd5ba chore: update source for stable 345.9
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4745.js (118.4 MB)
2026-09-18 20:18:48 +00:00

56 lines
2.3 KiB
TypeScript

// Module ID: 17647
// Function ID: 17648
// Name: ChangeVanityURLActionCreators
// Dependencies: [1074, 573, 1272, 2]
// Module 17647 (ChangeVanityURLActionCreators)
import DispatcherDefault from "Dispatcher" /* 573 */;
import Constants from "Constants" /* 1074 */;
import HTTPUtils from "HTTPUtils" /* 1272 */;
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(1272).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;
});
}
};