my question is :
in svelte actions, base on document(https://kit.svelte.dev/docs/form-actions#anatomy-of-an-action) when return some json data we can easily access it in client side, but when i try this i faced with a flated version of my json!
for better undrastaning i explain my question with this examples:
Simplified version of the server :
export const actions = {
search: async ({ request }) => {
const users = await prisma.users.findMany();
return {
data: users
};
},
};
and Simplified version of the client is :
<script>
export let data;
const onSearch = async (evt) => {
const response = await fetch('/users?/search', {
method: 'POST',
});
if (response.ok) {
const newData = await response.json();
console.log('newData', newData);
}
};
</script>
when i console.log(users) on server result is :
[ { id: 1 }, { id: 2 } ]
an when i console newData in my client, i recived this flated data that hard to read and hard to pars:
{type: 'success', status: 200, data: '[{"data":1},[2,4],{"id":3},1,{"id":5},2]'}
where i do wrong that make this happen to me.
p.s:
"svelte": "^3.54.0",
"@sveltejs/kit": "^1.0.0",