mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-04 21:15:22 +02:00
fix: Home Doesn't Load For Non-Admin Users (#2556)
* added non-admin route for fetching current group
* simplified frontend group slug fetching
* exposed public link even if user can't invite
* 🧹
This commit is contained in:
parent
15c6df88ab
commit
3e5596f898
6 changed files with 27 additions and 43 deletions
|
@ -5,7 +5,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, useContext } from "@nuxtjs/composition-api";
|
||||
import { defineComponent, ref } from "@nuxtjs/composition-api";
|
||||
import { invoke } from "@vueuse/core";
|
||||
import { useUserApi } from "~/composables/api/api-client";
|
||||
import RecipeExplorerPage from "~/components/Domain/Recipe/RecipeExplorerPage.vue";
|
||||
|
@ -13,23 +13,12 @@ import RecipeExplorerPage from "~/components/Domain/Recipe/RecipeExplorerPage.vu
|
|||
export default defineComponent({
|
||||
components: { RecipeExplorerPage },
|
||||
setup() {
|
||||
const { $auth } = useContext();
|
||||
const api = useUserApi();
|
||||
|
||||
// @ts-ignore $auth.user is typed as unknown, even though it's a user
|
||||
const groupId: string | undefined = $auth.user?.groupId;
|
||||
const groupSlug = ref<string>();
|
||||
|
||||
|
||||
invoke(async () => {
|
||||
if (!groupId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { data } = await api.groups.getOne(groupId);
|
||||
if (data) {
|
||||
groupSlug.value = data.slug;
|
||||
}
|
||||
const { data } = await api.users.getSelfGroup();
|
||||
groupSlug.value = data?.slug;
|
||||
});
|
||||
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue