mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-08-04 01:33:16 +00:00
26 lines
666 B
TypeScript
26 lines
666 B
TypeScript
// Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
|
|
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
import {LEVELS} from "./index";
|
|
import getLevelFields from "./getLevelFields";
|
|
import createError from "../../../../../../components/error/";
|
|
|
|
/**
|
|
* Fetches level from DOM using the ID passesd and validates
|
|
* its contents
|
|
* */
|
|
const validateLevel = (id: number): boolean => {
|
|
try {
|
|
const level = getLevelFields(id);
|
|
LEVELS.add(level);
|
|
return true;
|
|
} catch (e) {
|
|
createError(e.message);
|
|
return false;
|
|
}
|
|
};
|
|
|
|
export default validateLevel;
|