commit before i break things
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user