mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-15 20:33:12 -05:00
committed by
GitHub
parent
5aafb56c4f
commit
904e6b7d82
@@ -165,14 +165,14 @@ export function clearPageState(slug: string) {
|
||||
}
|
||||
|
||||
/**
|
||||
* usePageUser provides a wrapper around $auth that provides a type-safe way to
|
||||
* usePageUser provides a wrapper around auth that provides a type-safe way to
|
||||
* access the UserOut type from the context. If no user is logged in then an empty
|
||||
* object with all properties set to their zero value is returned.
|
||||
*/
|
||||
export function usePageUser(): { user: UserOut } {
|
||||
const $auth = useMealieAuth();
|
||||
const auth = useMealieAuth();
|
||||
|
||||
if (!$auth.user.value) {
|
||||
if (!auth.user.value) {
|
||||
return {
|
||||
user: {
|
||||
id: "",
|
||||
@@ -188,5 +188,5 @@ export function usePageUser(): { user: UserOut } {
|
||||
};
|
||||
}
|
||||
|
||||
return { user: $auth.user.value };
|
||||
return { user: auth.user.value };
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
export const useLoggedInState = function () {
|
||||
const $auth = useMealieAuth();
|
||||
const auth = useMealieAuth();
|
||||
const route = useRoute();
|
||||
|
||||
const loggedIn = computed(() => $auth.loggedIn.value);
|
||||
const loggedIn = computed(() => auth.loggedIn.value);
|
||||
const isOwnGroup = computed(() => {
|
||||
if (!route.params.groupSlug) {
|
||||
return loggedIn.value;
|
||||
}
|
||||
else {
|
||||
return loggedIn.value && $auth.user.value?.groupSlug === route.params.groupSlug;
|
||||
return loggedIn.value && auth.user.value?.groupSlug === route.params.groupSlug;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ const loading = ref(false);
|
||||
const ready = ref(false);
|
||||
|
||||
export const useUserSelfRatings = function () {
|
||||
const $auth = useMealieAuth();
|
||||
const auth = useMealieAuth();
|
||||
|
||||
async function refreshUserRatings() {
|
||||
if (!$auth.user.value || loading.value) {
|
||||
if (!auth.user.value || loading.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export const useUserSelfRatings = function () {
|
||||
loading.value = true;
|
||||
const api = useUserApi();
|
||||
|
||||
const userId = $auth.user.value?.id || "";
|
||||
const userId = auth.user.value?.id || "";
|
||||
await api.users.setRating(userId, slug, rating, isFavorite);
|
||||
|
||||
loading.value = false;
|
||||
|
||||
Reference in New Issue
Block a user