mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-16 16:21:32 +03:00
Added text handling in fetchWithValidation
This commit is contained in:
@@ -84,6 +84,9 @@ export default async function fetchWithValidation<DataOut, DataIn, ErrorOut, Err
|
||||
});
|
||||
}
|
||||
|
||||
const textPayload = schema.safeParse(text);
|
||||
if (textPayload.success) return ok(textPayload.data);
|
||||
|
||||
const safeParseJson = fromThrowable(JSON.parse, (e) => {
|
||||
if (e instanceof Error) {
|
||||
return err({
|
||||
|
||||
Reference in New Issue
Block a user