Skip to content

Commit

Permalink
fix: 在请求__serverLoader时,带上cookie,以实现在SSR时请求需要登入态的接口
Browse files Browse the repository at this point in the history
  • Loading branch information
奇风 committed Oct 18, 2023
1 parent b2eab5c commit 2a7ac13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/renderer-react/src/browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ const getBrowser = (
// use ?. since routes patched with patchClientRoutes is not exists in opts.routes
if (!isFirst && opts.routes[id]?.hasServerLoader) {
// 在有basename的情况下__serverLoader的请求路径需要加上basename
fetch((basename.endsWith('/') ? basename : basename + '/') + '__serverLoader?route=' + id)
fetch((basename.endsWith('/') ? basename : basename + '/') + '__serverLoader?route=' + id, {
credentials: 'include'
})
.then((d) => d.json())
.then((data) => {
// setServerLoaderData when startTransition because if ssr is enabled,
Expand Down

0 comments on commit 2a7ac13

Please sign in to comment.