77 lines
1.8 KiB
TypeScript
77 lines
1.8 KiB
TypeScript
// Metro module 15056 (f15057).
|
|
import { Endpoints } from "../../Constants";
|
|
import Dispatcher from "../../Dispatcher";
|
|
import { HTTP } from "../../_bundle/sendRequest";
|
|
import APIError from "../../errors/APIError";
|
|
export async function fetchActiveChannels(c27938_0, c27938_1) {
|
|
let r109;
|
|
let channels, c27938_5;
|
|
let c27938_6 = 0;
|
|
let c30835_1, c30835_0, c30835_2, c30835_3, c30835_4;
|
|
try {
|
|
c30835_1 = void 0;
|
|
c30835_0 = c27938_0;
|
|
if (c27938_1 !== void 0) {
|
|
c30835_1 = c27938_1;
|
|
c30835_2 = void 0;
|
|
c30835_3 = void 0;
|
|
} else {
|
|
c30835_1 = 10;
|
|
c30835_2 = void 0;
|
|
c30835_3 = void 0;
|
|
}
|
|
await void 0;
|
|
Dispatcher.dispatch({
|
|
type: "ACTIVE_CHANNELS_FETCH_START",
|
|
guildId: c30835_0
|
|
});
|
|
c27938_6 = 1;
|
|
c30835_2 = await HTTP.get({
|
|
url: Endpoints.ACTIVE_CHANNELS(c30835_0),
|
|
query: {
|
|
channel_limit: c30835_1
|
|
},
|
|
rejectWithError: true
|
|
});
|
|
channels = c30835_2.body?.channels;
|
|
if (channels == null) {
|
|
channels = [];
|
|
}
|
|
c30835_3 = channels;
|
|
Dispatcher.dispatch({
|
|
type: "ACTIVE_CHANNELS_FETCH_SUCCESS",
|
|
guildId: c30835_0,
|
|
channels: c30835_3
|
|
});
|
|
r109 = c30835_2;
|
|
c27938_6 = 0;
|
|
} catch ($e) {
|
|
const r31 = $e;
|
|
let r8 = r31;
|
|
c27938_5 = r31;
|
|
if (c27938_6 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r119 = c27938_5;
|
|
c27938_6 = 0;
|
|
c30835_4 = r119;
|
|
Dispatcher.dispatch({
|
|
type: "ACTIVE_CHANNELS_FETCH_FAILURE",
|
|
guildId: c30835_0,
|
|
error: new APIError(c30835_4)
|
|
});
|
|
throw c30835_4;
|
|
} catch (r115) {
|
|
r8 = r115;
|
|
c27938_5 = r115;
|
|
if (c27938_6 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return r109;
|
|
}
|