MiniSearch / client /modules /accessKey.ts
github-actions[bot]
Sync to HuggingFace Spaces
06cc844
raw
history blame contribute delete
703 Bytes
import { addLogEntry } from "./logEntries";
import { notifications } from "@mantine/notifications";
export async function validateAccessKey(accessKey: string) {
try {
const response = await fetch("/api/validate-access-key", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ accessKey }),
});
const data = await response.json();
return data.valid;
} catch (error) {
addLogEntry(`Error validating access key: ${error}`);
notifications.show({
title: "Error validating access key",
message: "Please contact the administrator",
color: "red",
position: "top-right",
});
return false;
}
}