mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 13:35:23 +02:00
Merge branch 'mealie-next' into feat-frontend-access-controll
This commit is contained in:
commit
704d0a8392
8 changed files with 173 additions and 41 deletions
|
@ -33,6 +33,7 @@ export interface AppInfo {
|
|||
version: string;
|
||||
demoStatus: boolean;
|
||||
allowSignup: boolean;
|
||||
defaultGroupSlug?: string;
|
||||
}
|
||||
export interface AppStartupInfo {
|
||||
isFirstLogin: boolean;
|
||||
|
|
|
@ -4,17 +4,28 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, useContext, useRouter } from "@nuxtjs/composition-api";
|
||||
import { AppInfo } from "~/lib/api/types/admin";
|
||||
|
||||
export default defineComponent({
|
||||
layout: "blank",
|
||||
setup() {
|
||||
const { $auth } = useContext();
|
||||
const { $auth, $axios } = useContext();
|
||||
const router = useRouter();
|
||||
const groupSlug = computed(() => $auth.user?.groupSlug);
|
||||
|
||||
async function redirectPublicUserToDefaultGroup() {
|
||||
const { data } = await $axios.get<AppInfo>("/api/app/about");
|
||||
if (data?.defaultGroupSlug) {
|
||||
router.push(`/g/${data.defaultGroupSlug}`);
|
||||
} else {
|
||||
router.push("/login");
|
||||
}
|
||||
}
|
||||
|
||||
if (groupSlug.value) {
|
||||
router.push(`/g/${groupSlug.value}`);
|
||||
} else {
|
||||
router.push("/login");
|
||||
redirectPublicUserToDefaultGroup();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue