fix: registration and registration detection handling
This commit is contained in:
parent
febdbb9421
commit
038b1af44e
3 changed files with 34 additions and 25 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue