diff --git a/packages/pl-fe/src/entity-store/hooks/useCreateEntity.ts b/packages/pl-fe/src/entity-store/hooks/useCreateEntity.ts index c5a6a99e9c..9ed3694717 100644 --- a/packages/pl-fe/src/entity-store/hooks/useCreateEntity.ts +++ b/packages/pl-fe/src/entity-store/hooks/useCreateEntity.ts @@ -32,7 +32,7 @@ const useCreateEntity = => { const result = await setPromise(entityFn(data)); const schema = opts.schema || z.custom(); - let entity: TEntity | TTransformedEntity = schema.parse(result.json); + let entity: TEntity | TTransformedEntity = schema.parse(result); if (opts.transform) entity = opts.transform(entity); // TODO: optimistic updating diff --git a/packages/pl-fe/src/entity-store/hooks/useEntityLookup.ts b/packages/pl-fe/src/entity-store/hooks/useEntityLookup.ts index 17d93b43c9..bf598d8b8f 100644 --- a/packages/pl-fe/src/entity-store/hooks/useEntityLookup.ts +++ b/packages/pl-fe/src/entity-store/hooks/useEntityLookup.ts @@ -36,10 +36,10 @@ const useEntityLookup = { try { const response = await setPromise(entityFn()); - const entity = schema.parse(response.json); + const entity = schema.parse(response); const transformedEntity = opts.transform ? opts.transform(entity) : entity; setFetchedEntity(transformedEntity as TTransformedEntity); - dispatch(importEntities([entity], entityType)); + dispatch(importEntities([transformedEntity], entityType)); } catch (e) { setError(e); }