Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/api/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const useActionBySession = (coachingSessionId: Id) => {
* error: Error object if the last operation failed, null otherwise
*/
export const useActionMutation = () => {
return EntityApi.useEntityMutation<Action, Action>(ACTIONS_BASEURL, {
return EntityApi.useEntityMutation<Action>(ACTIONS_BASEURL, {
create: ActionApi.create,
createNested: ActionApi.createNested,
update: ActionApi.update,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/api/agreements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export const useAgreementBySession = (coachingSessionId: Id) => {
* error: Error object if the last operation failed, null otherwise
*/
export const useAgreementMutation = () => {
return EntityApi.useEntityMutation<Agreement, Agreement>(AGREEMENTS_BASEURL, {
return EntityApi.useEntityMutation<Agreement>(AGREEMENTS_BASEURL, {
create: AgreementApi.create,
createNested: AgreementApi.createNested,
update: AgreementApi.update,
Expand Down
5 changes: 1 addition & 4 deletions src/lib/api/coaching-relationships.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,7 @@ export const useCoachingRelationship = (
* Provides methods to create, update, and delete coaching relationships.
*/
export const useCoachingRelationshipMutation = (organizationId: Id) => {
return EntityApi.useEntityMutation<
CoachingRelationshipWithUserNames,
CoachingRelationshipWithUserNames
>(
return EntityApi.useEntityMutation<CoachingRelationshipWithUserNames>(
`${ORGANIZATIONS_BASEURL}/${organizationId}/${COACHING_RELATIONSHIPS_BASEURL}`,
{
create: CoachingRelationshipApi.create,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/api/coaching-sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export const useCoachingSession = (id: Id) => {
* error: Error object if the last operation failed, null otherwise
*/
export const useCoachingSessionMutation = () => {
return EntityApi.useEntityMutation<CoachingSession, CoachingSession>(
return EntityApi.useEntityMutation<CoachingSession>(
COACHING_SESSIONS_BASEURL,
{
create: CoachingSessionApi.create,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/api/entity-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export namespace EntityApi {
* @param api Object containing CRUD operations for the entity
* @returns Object with CRUD methods, loading state, and error state
*/
export const useEntityMutation = <T, U>(
export const useEntityMutation = <T, U = T>(
baseUrl: string,
api: {
create: (entity: T) => Promise<U>;
Expand Down
15 changes: 6 additions & 9 deletions src/lib/api/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,10 @@ export const useOrganization = (id: Id) => {
* Provides methods to create, update, and delete organizations.
*/
export const useOrganizationMutation = () => {
return EntityApi.useEntityMutation<Organization, Organization>(
ORGANIZATIONS_BASEURL,
{
create: OrganizationApi.create,
createNested: OrganizationApi.createNested,
update: OrganizationApi.update,
delete: OrganizationApi.delete,
}
);
return EntityApi.useEntityMutation<Organization>(ORGANIZATIONS_BASEURL, {
create: OrganizationApi.create,
createNested: OrganizationApi.createNested,
update: OrganizationApi.update,
delete: OrganizationApi.delete,
});
};
2 changes: 1 addition & 1 deletion src/lib/api/overarching-goals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export const useOverarchingGoalBySession = (coachingSessionId: Id) => {
* Provides methods to create, update, and delete overarching-goal.
*/
export const useOverarchingGoalMutation = () => {
return EntityApi.useEntityMutation<OverarchingGoal, OverarchingGoal>(
return EntityApi.useEntityMutation<OverarchingGoal>(
OVERARCHING_GOALS_BASEURL,
{
create: OverarchingGoalApi.create,
Expand Down
15 changes: 6 additions & 9 deletions src/lib/api/user-sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,10 @@ export const UserSessionApi = {
* error: Error object if the last operation failed, null otherwise
*/
export const useUserSessionMutation = () => {
return EntityApi.useEntityMutation<UserSession, UserSession>(
USER_SESSIONS_BASEURL,
{
create: UserSessionApi.create,
createNested: UserSessionApi.createNested,
update: UserSessionApi.update,
delete: UserSessionApi.delete,
}
);
return EntityApi.useEntityMutation<UserSession>(USER_SESSIONS_BASEURL, {
create: UserSessionApi.create,
createNested: UserSessionApi.createNested,
update: UserSessionApi.update,
delete: UserSessionApi.delete,
});
};
2 changes: 1 addition & 1 deletion src/lib/api/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const useUser = (id: Id) => {
* Provides methods to create, update, and delete users.
*/
export const useUserMutation = () => {
return EntityApi.useEntityMutation<User, User>(USERS_BASEURL, {
return EntityApi.useEntityMutation<User>(USERS_BASEURL, {
create: UserApi.create,
createNested: UserApi.createNested,
update: UserApi.update,
Expand Down