fix: adds credentials to doc access request (#2705)

This commit is contained in:
Jarrod Flesch
2023-05-24 10:39:03 -04:00
committed by GitHub
parent 2fc9288870
commit c716954e89

View File

@@ -198,7 +198,12 @@ export const DocumentInfoProvider: React.FC<Props> = ({
}
if (docAccessURL) {
const res = await fetch(`${serverURL}${api}${docAccessURL}`);
const res = await fetch(`${serverURL}${api}${docAccessURL}`, {
credentials: 'include',
headers: {
'Accept-Language': i18n.language,
},
});
const json = await res.json();
setDocPermissions(json);
} else {
@@ -206,7 +211,7 @@ export const DocumentInfoProvider: React.FC<Props> = ({
// (i.e. create has no id)
setDocPermissions(permissions[pluralType][slug]);
}
}, [serverURL, api, pluralType, slug, id, permissions]);
}, [serverURL, api, pluralType, slug, id, permissions, i18n.language]);
useEffect(() => {
getVersions();