decord/source/modules/premium/powerups/hooks/useGuildPowerupOnToggle.tsx

49 lines
1.5 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 11754
// Function ID: 11755
2026-07-20 16:05:17 +00:00
// Name: useGuildPowerupOnToggle
2026-08-24 06:08:38 +00:00
// Dependencies: [32, 19, 11706, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 11754 (useGuildPowerupOnToggle)
import closure_2 from "_slicedToArray" /* 32 */;
import closure_3 from "noop" /* 19 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/premium/powerups/hooks/useGuildPowerupOnToggle.tsx");
2026-07-20 16:05:17 +00:00
export default function useGuildPowerupOnToggle(arg0, arg1) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
[tmp2, closure_2] = callback(React.useState(false), 2);
2026-07-29 08:29:29 +00:00
const tmp3 = callback(React.useState(undefined), 2);
2026-07-23 10:11:24 +00:00
React = tmp3[1];
2026-07-29 08:29:29 +00:00
const tmp = callback(React.useState(false), 2);
2026-07-20 16:05:17 +00:00
const items = [arg0, arg1];
return {
isLoading: tmp2,
error: tmp3[0],
onToggle: React.useCallback((arg0) => {
2026-07-29 08:29:29 +00:00
if (null == table) {
2026-07-20 16:05:17 +00:00
return Promise.resolve();
} else {
2026-07-29 08:29:29 +00:00
const tmp5 = callback(table[2]);
2026-07-23 10:11:24 +00:00
callback2(true);
callback3(undefined);
2026-07-29 08:29:29 +00:00
const tmp6 = arg0 ? tmp5.enablePowerupForGuild : tmp5.disablePowerupForGuild;
const tmp6Result = arg0 ? tmp5.enablePowerupForGuild : tmp5.disablePowerupForGuild(callback, tmp.skuId);
return arg0 ? tmp5.enablePowerupForGuild : tmp5.disablePowerupForGuild(callback, tmp.skuId).catch((body) => {
2026-07-20 16:05:17 +00:00
body = body.body;
let message;
2026-07-29 08:29:29 +00:00
if (body != null) {
2026-07-20 16:05:17 +00:00
message = body.message;
}
2026-08-24 06:08:38 +00:00
closure_3(message);
2026-07-20 16:05:17 +00:00
throw body;
}).finally(() => {
2026-07-29 08:29:29 +00:00
callback(false);
2026-07-20 16:05:17 +00:00
});
}
}, items)
};
};