Skip to content

Commit

Permalink
refactor: update collaborators list loader to return Error type on fa…
Browse files Browse the repository at this point in the history
…ilure
  • Loading branch information
pavkout committed Feb 10, 2025
1 parent d7e429a commit 25d75e4
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions packages/insomnia/src/ui/routes/invite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface Collaborator {
metadata: CollaboratorMetadata;
};

export interface CollaboratorsListLoaderResult extends PaginatedList<{ collaborators: Collaborator[] }> { };
export type CollaboratorsListLoaderResult = PaginatedList<{ collaborators: Collaborator[] }> | Error;

export const collaboratorsListLoader: LoaderFunction = async ({ params, request }): Promise<CollaboratorsListLoaderResult> => {
const { id: sessionId } = await userSession.get();
Expand Down Expand Up @@ -65,14 +65,7 @@ export const collaboratorsListLoader: LoaderFunction = async ({ params, request

return collaboratorsList;
} catch (err) {
return {
start: 0,
limit: 15,
length: 0,
total: 0,
next: '',
collaborators: [],
};
return new Error(err.message);
}
};

Expand Down

0 comments on commit 25d75e4

Please sign in to comment.