commit before i break things

This commit is contained in:
2026-06-01 23:40:58 +02:00
parent 73c9bc1f14
commit 4db77055ed
11 changed files with 152 additions and 83 deletions
+15 -7
View File
@@ -103,8 +103,15 @@ export type RegisterPayload = { email: string; password: string; name?: string }
export const authApi = {
login: (p: LoginPayload) => post<JwtResponse>("/login", p),
register: (p: RegisterPayload) => post<UserDTO>("/register", p),
getUser: (userId: string, token: string) => get<UserDTO>(`/users/${userId}`, token),
updateUser: (body: UserUpdateDTO, token: string) => request<UserDTO>("PUT", "/users", token, body),
getUser: (token: string) =>
get<UserDTO>("/users/me", token),
updateUser: (body: UserUpdateDTO, token: string) =>
request<UserDTO>("PUT", "/users/me", token, body),
deleteUser: (token: string) =>
del<void>("/users/me", token),
};
@@ -114,19 +121,20 @@ export const subjectsApi = {
};
export const subscriptionsApi = {
subscribe: (userId: string, subjectId: string, token: string) =>
subscribe: (subjectId: string, token: string) =>
put<UserDTO>(
`/users/${userId}/subjects/${subjectId}`,
{}, // body placeholder
`/users/me/subjects/${subjectId}`,
{},
token
),
unsubscribe: (userId: string, subjectId: string, token: string) =>
unsubscribe: (subjectId: string, token: string) =>
del<UserDTO>(
`/users/${userId}/subjects/${subjectId}`,
`/users/me/subjects/${subjectId}`,
token
),
};
export const entriesApi = {
getEntries: (params: { subjectId?: string; groupName?: string; page?: number }) =>
get<SpringPage<Entry>>("/entries", undefined, params),