refactor: remove unnecessary computed
Fixes lint no-const-assign.
This commit is contained in:
parent
366fae41ff
commit
935fce338a
|
@ -61,27 +61,22 @@ let hcaptchaSecretKey: string | null = $ref(null);
|
||||||
let recaptchaSiteKey: string | null = $ref(null);
|
let recaptchaSiteKey: string | null = $ref(null);
|
||||||
let recaptchaSecretKey: string | null = $ref(null);
|
let recaptchaSecretKey: string | null = $ref(null);
|
||||||
|
|
||||||
const enableHcaptcha = $computed(() => provider === 'hcaptcha');
|
|
||||||
const enableRecaptcha = $computed(() => provider === 'recaptcha');
|
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
const meta = await os.api('admin/meta');
|
const meta = await os.api('admin/meta');
|
||||||
enableHcaptcha = meta.enableHcaptcha;
|
|
||||||
hcaptchaSiteKey = meta.hcaptchaSiteKey;
|
hcaptchaSiteKey = meta.hcaptchaSiteKey;
|
||||||
hcaptchaSecretKey = meta.hcaptchaSecretKey;
|
hcaptchaSecretKey = meta.hcaptchaSecretKey;
|
||||||
enableRecaptcha = meta.enableRecaptcha;
|
|
||||||
recaptchaSiteKey = meta.recaptchaSiteKey;
|
recaptchaSiteKey = meta.recaptchaSiteKey;
|
||||||
recaptchaSecretKey = meta.recaptchaSecretKey;
|
recaptchaSecretKey = meta.recaptchaSecretKey;
|
||||||
|
|
||||||
provider = enableHcaptcha ? 'hcaptcha' : enableRecaptcha ? 'recaptcha' : null;
|
provider = meta.enableHcaptcha ? 'hcaptcha' : meta.enableRecaptcha ? 'recaptcha' : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
os.apiWithDialog('admin/update-meta', {
|
os.apiWithDialog('admin/update-meta', {
|
||||||
enableHcaptcha,
|
enableHcaptcha: provider === 'hcaptcha',
|
||||||
hcaptchaSiteKey,
|
hcaptchaSiteKey,
|
||||||
hcaptchaSecretKey,
|
hcaptchaSecretKey,
|
||||||
enableRecaptcha,
|
enableRecaptcha: provider === 'recaptcha',
|
||||||
recaptchaSiteKey,
|
recaptchaSiteKey,
|
||||||
recaptchaSecretKey,
|
recaptchaSecretKey,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|
Loading…
Reference in a new issue