mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-18 21:45:12 +00:00
fix server-side fetch paths
This commit is contained in:
@@ -173,7 +173,7 @@ function get_route_handler(chunks: Record<string, string>, routes: RouteObject[]
|
|||||||
error = { statusCode, message };
|
error = { statusCode, message };
|
||||||
},
|
},
|
||||||
fetch: (url: string, opts?: any) => {
|
fetch: (url: string, opts?: any) => {
|
||||||
const parsed = new URL(url, `http://127.0.0.1:${process.env.PORT}${req.baseUrl}${req.path}`);
|
const parsed = new URL(url, `http://127.0.0.1:${process.env.PORT}${req.baseUrl ? req.baseUrl + '/' :''}`);
|
||||||
|
|
||||||
if (opts) {
|
if (opts) {
|
||||||
opts = Object.assign({}, opts);
|
opts = Object.assign({}, opts);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
preload({ query }) {
|
preload({ query }) {
|
||||||
console.log(`here ${this.fetch}`);
|
|
||||||
return this.fetch(`credentials/test.json`, {
|
return this.fetch(`credentials/test.json`, {
|
||||||
credentials: query.creds
|
credentials: query.creds
|
||||||
}).then(r => r.json());
|
}).then(r => r.json());
|
||||||
|
|||||||
Reference in New Issue
Block a user