Skip to content

Commit 576b19f

Browse files
committed
Try to fix public data CORS problem
1 parent 30321e1 commit 576b19f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/logic.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ import * as debug from './debug'
55
import authSession from './authn/authSession'
66
import { SolidLogic } from 'solid-logic'
77

8-
const fetcher = async (url, requestInit) => {
9-
if (authSession.info.webId) {
8+
async function thisFetch (url, requestInit) => {
9+
const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'
10+
if (authSession.info.webId && !omitCreds) {
1011
return authSession.fetch(url, requestInit)
1112
} else {
1213
return window.fetch(url, requestInit)
1314
}
1415
}
1516

16-
export const solidLogicSingleton = new SolidLogic({ fetch: fetcher }, authSession)
17+
export const solidLogicSingleton = new SolidLogic({ fetch: thisFetch }, authSession)
1718

1819
// Make this directly accessible as it is what you need most of the time
1920
export const store = solidLogicSingleton.store

0 commit comments

Comments
 (0)