Skip to content

Commit

Permalink
fix(fetch): allow data with error
Browse files Browse the repository at this point in the history
`data` is valid and expected for some errors. `validateLicense` function is an example.
  • Loading branch information
brankoconjic committed Jun 14, 2024
1 parent 80d4357 commit 79cd3f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/internal/fetch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export async function $fetch<T>(options: FetchOptions, needApiKey = true) {

Object.assign(response, {
statusCode: fetchStatus,
data: null,
data,
error: createLemonError(fetchResponse.statusText, _error),
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/internal/fetch/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type FetchResponse<T> =
}
| {
statusCode: number | null;
data: null;
data: T | null;
error: Error;
};

Expand Down

0 comments on commit 79cd3f4

Please sign in to comment.