1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-03 04:25:24 +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:
Michael Genson 2023-09-19 12:06:39 -05:00 committed by GitHub
parent 15c6df88ab
commit 3e5596f898
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 43 deletions

View file

@ -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 {

View file

@ -8,9 +8,9 @@
{{ $t('profile.description') }}
<a href="https://hay-kot.github.io/mealie/" target="_blank"> {{ $t('general.learn-more') }} </a>
</p>
<v-card v-if="$auth.user.canInvite" flat color="background" width="100%" max-width="600px">
<v-card flat color="background" width="100%" max-width="600px">
<v-card-actions class="d-flex justify-center">
<v-btn outlined rounded @click="getSignupLink()">
<v-btn v-if="$auth.user.canInvite" outlined rounded @click="getSignupLink()">
<v-icon left>
{{ $globals.icons.createAlt }}
</v-icon>
@ -257,7 +257,7 @@ export default defineComponent({
return;
}
const { data } = await api.groups.getOne(user.value.groupId);
const { data } = await api.users.getSelfGroup();
group.value = data;
});