Files
discord-decomp/modules/guild_config_gates/GuildConfigGates.tsx
T
2026-11-01 12:12:55 +02:00

60 lines
2.2 KiB
TypeScript

// Metro module 16479 (f16480).
import GuildConfigGatesStore from "./GuildConfigGatesStore";
import { Endpoints } from "../../Constants";
import { createFetchStore } from "../../_bundle/Module589";
import { HTTP } from "../../_bundle/sendRequest";
import Dispatcher from "../../Dispatcher";
let fetchStore;
let c11859_3 = async (c23251_0) => {
let guild_verification_role_enabled, application_identity_linked_roles_enabled, c23251_4;
let c28418_0, c28418_1;
L17: {
c23251_4 = void 0;
c28418_0 = c23251_0;
c28418_1 = void 0;
if (c23251_0 != null) {
c28418_1 = (await HTTP.get(Endpoints.GUILD_CONFIG_GATES(c23251_0))).body;
const guild_verification_role_enabled2 = c28418_1.guild_verification_role_enabled;
guild_verification_role_enabled = guild_verification_role_enabled2;
if (guild_verification_role_enabled2 == null) {
guild_verification_role_enabled = false;
}
const application_identity_linked_roles_enabled2 = c28418_1.application_identity_linked_roles_enabled;
application_identity_linked_roles_enabled = application_identity_linked_roles_enabled2;
if (application_identity_linked_roles_enabled2 == null) {
application_identity_linked_roles_enabled = false;
}
Dispatcher.dispatch({
type: "GUILD_CONFIG_GATES_FETCH_SUCCESS",
guildId: c28418_0,
guildVerificationRoleEnabled: guild_verification_role_enabled,
applicationIdentityLinkedRolesEnabled: application_identity_linked_roles_enabled
});
break L17;
}
return void 0;
}
};
fetchStore = createFetchStore(GuildConfigGatesStore, {
getQueryId: (a0) => a0 == null ? null : a0,
get: (a0) => a0 == null ? null : GuildConfigGatesStore.hasLoaded(a0) ? GuildConfigGatesStore.getGates(a0) : null,
load: function() {
const apply = c11859_3.apply;
return c11859_3.apply(this, arguments);
}
});
export function useGuildVerificationRoleEnabled(a0) {
let r8 = fetchStore(a0).data?.guildVerificationRoleEnabled;
if (r8 == null) {
r8 = false;
}
return r8;
}
export function useApplicationIdentityLinkedRolesEnabled(a0) {
let r8 = fetchStore(a0).data?.applicationIdentityLinkedRolesEnabled;
if (r8 == null) {
r8 = false;
}
return r8;
}