1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-23 15:19:41 +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

@ -1,7 +1,9 @@
import { BaseCRUDAPI } from "../base/base-clients";
import { RequestResponse } from "../types/non-generated";
import {
ChangePassword,
DeleteTokenResponse,
GroupInDB,
LongLiveTokenIn,
LongLiveTokenOut,
ResetPassword,
@ -15,6 +17,7 @@ const prefix = "/api";
const routes = {
usersSelf: `${prefix}/users/self`,
groupsSelf: `${prefix}/users/self/group`,
passwordReset: `${prefix}/users/reset-password`,
passwordChange: `${prefix}/users/password`,
users: `${prefix}/users`,
@ -33,6 +36,10 @@ export class UserApi extends BaseCRUDAPI<UserIn, UserOut, UserBase> {
baseRoute: string = routes.users;
itemRoute = (itemid: string) => routes.usersId(itemid);
async getSelfGroup(): Promise<RequestResponse<GroupInDB>> {
return await this.requests.get(routes.groupsSelf, {});
}
async addFavorite(id: string, slug: string) {
return await this.requests.post(routes.usersIdFavoritesSlug(id, slug), {});
}