Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4792.js (118.4 MB)
47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
// Module ID: 12631
|
|
// Function ID: 12632
|
|
// Name: useGuildPowerupOnToggle
|
|
// Dependencies: [32, 19, 12583, 2]
|
|
// Exports: default
|
|
|
|
// Module 12631 (useGuildPowerupOnToggle)
|
|
import GuildPowerupsActionCreators from "GuildPowerupsActionCreators" /* 12583 */;
|
|
import _slicedToArray from "module_32" /* 32 */;
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
require = fn;
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/premium/powerups/hooks/useGuildPowerupOnToggle.tsx");
|
|
|
|
export default function useGuildPowerupOnToggle(arg0, arg1) {
|
|
closure_0 = arg0;
|
|
closure_1 = arg1;
|
|
[tmp2, _slicedToArray] = noop.useState(false);
|
|
const tmp3 = _slicedToArray(noop.useState(undefined), 2);
|
|
noop = tmp3[1];
|
|
const obj = { isLoading: tmp2, error: tmp3[0], onToggle: null };
|
|
const items = [arg0, arg1];
|
|
obj.onToggle = noop.useCallback((arg0) => {
|
|
if (null == closure_1) {
|
|
return Promise.resolve();
|
|
} else {
|
|
const tmp5 = GuildPowerupsActionCreators;
|
|
_slicedToArray(true);
|
|
closure_3(undefined);
|
|
const tmp6 = arg0 ? tmp5.enablePowerupForGuild : tmp5.disablePowerupForGuild;
|
|
const tmp6Result = arg0 ? tmp5.enablePowerupForGuild : tmp5.disablePowerupForGuild(closure_0, tmp.skuId);
|
|
return arg0 ? tmp5.enablePowerupForGuild : tmp5.disablePowerupForGuild(closure_0, tmp.skuId).catch((error) => {
|
|
const body = error.body;
|
|
let message;
|
|
if (body != null) {
|
|
message = body.message;
|
|
}
|
|
closure_1_3(message);
|
|
throw error;
|
|
}).finally(() => {
|
|
closure_1_2(false);
|
|
});
|
|
}
|
|
}, items);
|
|
return obj;
|
|
};
|