fix: registration and registration detection handling

This commit is contained in:
SauceyRed 2025-06-01 01:41:36 +02:00
parent febdbb9421
commit 038b1af44e
Signed by: sauceyred
GPG key ID: 2BF92EB6D8A5CCA7
3 changed files with 34 additions and 25 deletions

View file

@ -47,14 +47,17 @@ definePageMeta({
layout: "auth"
})
const instanceUrl = useCookie("instance_url").value;
const registrationEnabled = ref<boolean>(false);
const registrationEnabled = useState("registrationEnabled", () => true);
if (instanceUrl) {
const statsUrl = new URL("/stats", instanceUrl).href;
const { status, data, error } = await useFetch<StatsResponse>(statsUrl);
console.log("wah");
console.log("weoooo")
const apiBase = useCookie("api_base");
console.log("apiBase:", apiBase.value);
if (apiBase.value) {
const { status, data, error } = await useFetch<StatsResponse>(`${apiBase.value}/stats`);
if (status.value == "success" && data.value) {
registrationEnabled.value = data.value.registration_enabled;
console.log("set registration enabled value to:", data.value.registration_enabled);
}
}
@ -92,12 +95,6 @@ const query = useRoute().query as Record<string, string>;
const searchParams = new URLSearchParams(query);
const loginUrl = `/login?${searchParams}`
onMounted(() => {
if (auth.accessToken.value) {
//return navigateTo(redirectTo ? redirectTo as string : useAppConfig().baseURL as string);
}
});
/*
watch(() => form.username, (newValue) => {
console.log("username change:", newValue);