123 lines
2.8 KiB
TypeScript
123 lines
2.8 KiB
TypeScript
// Metro module 11750 (f11751).
|
|
import { Endpoints } from "../../Constants";
|
|
import Dispatcher from "../../Dispatcher";
|
|
import { HTTP } from "../../_bundle/sendRequest";
|
|
export function welcomeScreenViewed(a0, isLurking = false) {
|
|
Dispatcher.dispatch({
|
|
type: "WELCOME_SCREEN_VIEW",
|
|
guildId: a0,
|
|
isLurking
|
|
});
|
|
}
|
|
export async function fetchWelcomeScreen(c27143_0) {
|
|
let body;
|
|
let c27143_4 = 0;
|
|
let c30436_0, c30436_1;
|
|
try {
|
|
c30436_0 = c27143_0;
|
|
c30436_1 = void 0;
|
|
Dispatcher.dispatch({
|
|
type: "WELCOME_SCREEN_FETCH_START"
|
|
});
|
|
c27143_4 = 1;
|
|
c30436_1 = await HTTP.get({
|
|
url: Endpoints.GUILD_WELCOME_SCREEN(c27143_0),
|
|
oldFormErrors: true,
|
|
rejectWithError: true
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "WELCOME_SCREEN_FETCH_SUCCESS",
|
|
guildId: c30436_0,
|
|
welcomeScreen: c30436_1.body
|
|
});
|
|
body = c30436_1.body;
|
|
c27143_4 = 0;
|
|
} catch ($e) {
|
|
let r8 = $e;
|
|
if (c27143_4 !== 0) {
|
|
while (true) {
|
|
try {
|
|
c27143_4 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "WELCOME_SCREEN_FETCH_FAIL"
|
|
});
|
|
} catch ($e) {
|
|
r8 = $e;
|
|
if (c27143_4 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
return void 0;
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return body;
|
|
}
|
|
export function resetWelcomeScreen() {
|
|
Dispatcher.dispatch({
|
|
type: "WELCOME_SCREEN_SETTINGS_RESET"
|
|
});
|
|
}
|
|
export function clearWelcomeScreenSettings() {
|
|
Dispatcher.dispatch({
|
|
type: "WELCOME_SCREEN_SETTINGS_CLEAR"
|
|
});
|
|
}
|
|
export function updateSettings(a0) {
|
|
Dispatcher.dispatch({
|
|
type: "WELCOME_SCREEN_SETTINGS_UPDATE",
|
|
settings: a0
|
|
});
|
|
}
|
|
export async function saveWelcomeScreen(c27144_0, c27144_1) {
|
|
let c27144_5 = 0;
|
|
let c30437_0, c30437_1;
|
|
L10: {
|
|
try {
|
|
c30437_0 = c27144_0;
|
|
c30437_1 = void 0;
|
|
Dispatcher.dispatch({
|
|
type: "WELCOME_SCREEN_SUBMIT"
|
|
});
|
|
c27144_5 = 1;
|
|
c30437_1 = await HTTP.patch({
|
|
url: Endpoints.GUILD_WELCOME_SCREEN(c27144_0),
|
|
body: {
|
|
description: c27144_1.description,
|
|
welcome_channels: c27144_1.channels,
|
|
enabled: c27144_1.enabled
|
|
},
|
|
oldFormErrors: true,
|
|
rejectWithError: true
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "WELCOME_SCREEN_SUBMIT_SUCCESS",
|
|
guildId: c30437_0,
|
|
welcomeScreen: c30437_1.body
|
|
});
|
|
c27144_5 = 0;
|
|
} catch ($e) {
|
|
let r8 = $e;
|
|
if (c27144_5 !== 0) {
|
|
while (true) {
|
|
try {
|
|
c27144_5 = 0;
|
|
Dispatcher.dispatch({
|
|
type: "WELCOME_SCREEN_SUBMIT_FAILURE"
|
|
});
|
|
break L10;
|
|
} catch ($e) {
|
|
r8 = $e;
|
|
if (c27144_5 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
}
|
|
}
|