Skip to content
Open
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
14 changes: 10 additions & 4 deletions lib/api/services/organizationServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const findAllByOrganizationParent = async (
params?: {
page?: number;
limit?: number;
}
},
) => {
const queryParams = new URLSearchParams({
page: (params?.page || 1).toString(),
Expand All @@ -69,7 +69,7 @@ export const findAllByOrganizationParent = async (
{
method: "GET",
credentials: "include",
}
},
);

if (!response.ok) {
Expand All @@ -91,11 +91,17 @@ export const findOneOrganization = async (id: string) => {
}

const data = await response.json();
if (data.user?.email) {
return {
...data,
email: data.user.email,
};
}
return data;
};

export const createOrganization = async (
orgData: CreateOrganizationRequest
orgData: CreateOrganizationRequest,
) => {
const response = await fetch(`${BASE_URL}/organizations`, {
method: "POST",
Expand All @@ -116,7 +122,7 @@ export const createOrganization = async (

export const updateOrganization = async (
id: string,
orgData: Partial<CreateOrganizationRequest>
orgData: Partial<CreateOrganizationRequest>,
) => {
const response = await fetch(`${BASE_URL}/organizations/${id}`, {
method: "PATCH",
Expand Down