Files
discord-decomp/modules/guild_member_verification/hooks/useCanReapplyToRejectedMemberVerificationApplication.tsx
T
2026-11-01 12:12:55 +02:00

85 lines
2.5 KiB
TypeScript

// Metro module 9159 (f9160).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useState, useCallback, useEffect } from "react";
import InviteStore from "../../../stores/InviteStore";
import UserGuildJoinRequestStore from "../UserGuildJoinRequestStore";
import { GuildFeatures } from "../../../Constants";
import { useStateFromStores } from "../../../_bundle/Module589";
import MemberVerificationActionCreators from "../MemberVerificationActionCreators";
let env6011 = {};
export function useCanReapplyToRejectedMemberVerificationApplication(a0) {
let c17043_0;
let env17042 = {
$parent: env6011
};
env17042[0] = a0;
const r14 = _slicedToArray(useState(true), 2);
const isLoading = r14[0];
env17042[1] = r14[1];
const stateFromStores = useStateFromStores([UserGuildJoinRequestStore], () => {
const r4 = env17042[0];
return r4 != null ? UserGuildJoinRequestStore.getJoinRequestGuild(r4) : void 0;
});
c17043_0 = void 0;
c17043_0 = async (c30051_0) => {
let c30051_1, c30051_3;
let c30051_4 = 0;
const r11 = void 0;
L12: {
try {
c30051_1 = r11;
c30051_4 = 1;
const inviteKeyForGuildId = InviteStore.getInviteKeyForGuildId(c30051_0);
if (inviteKeyForGuildId != null) {
await MemberVerificationActionCreators.fetchVerificationForm(c30051_0, inviteKeyForGuildId);
c30051_4 = 0;
(0, c30051_1.$parent[1])(false);
break L12;
}
c30051_4 = 0;
(0, c30051_1.$parent[1])(false);
} catch ($e) {
const r26 = $e;
let r7 = r26;
c30051_3 = r26;
if (c30051_4 !== 0) {
while (true) {
try {
const r68 = c30051_1;
const r69 = c30051_3;
c30051_4 = 0;
(0, r68.$parent[1])(false);
throw r69;
} catch (r66) {
r7 = r66;
c30051_3 = r66;
if (c30051_4 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
};
const callback = useCallback(function() {
return c17043_0.apply(this, arguments);
}, []);
env17042[2] = callback;
useEffect(() => {
const r4 = env17042[0];
if (r4 == null) {
(0, env17042[1])(false);
} else {
(0, env17042[1])(true);
(0, env17042[2])(r4);
}
}, [a0, callback]);
return {
canReapply: stateFromStores != null && stateFromStores.features.has(GuildFeatures.MEMBER_VERIFICATION_MANUAL_APPROVAL),
isLoading
};
}