mirror of https://github.com/fantasticit/think.git
client: catch error
This commit is contained in:
parent
86755013b4
commit
cd071ccae1
|
@ -14,15 +14,19 @@ export async function serverPrefetcher(ctx: NextPageContext, actions: PrefetchAc
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryClient = new QueryClient();
|
try {
|
||||||
|
const queryClient = new QueryClient();
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
actions.map((action) => {
|
actions.map((action) => {
|
||||||
return queryClient.prefetchQuery(action.url, () => action.action(cookie));
|
return queryClient.prefetchQuery(action.url, () => action.action(cookie));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dehydratedState: dehydrate(queryClient),
|
dehydratedState: dehydrate(queryClient),
|
||||||
};
|
};
|
||||||
|
} catch (err) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue