Skip to content

Commit

Permalink
Merge branch 'fix-dalec-fetch-content-channel-objects' into 'main'
Browse files Browse the repository at this point in the history
fix(dalec_fetch_content): copy dataset content to avoid conflicts

See merge request w/i/dalec!6
  • Loading branch information
DylannCordel committed Sep 19, 2023
2 parents 635e3f4 + 014848b commit 1b78471
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Federation Open Space Makers <https://www.federation-openspacemakers.com>

Dylann CORDEL <[email protected]>
Samuel WEBER <[email protected]>
Adrien HAMRAOUI <[email protected]>
17 changes: 11 additions & 6 deletions dalec/static/dalec/js/main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@


function dalec_fetch_content(container){
const data = container.dataset ;
const [ orderedBy, url ] = [
container.dataset.orderedBy,
container.dataset.url
];
let channelObjects = container.dataset.channelObjects;

container.classList.add("dalec-loading");
if (data.channelObjects !== undefined){
data.channelObjects = JSON.parse(data.channelObjects)
if (channelObjects !== undefined){
channelObjects = JSON.parse(channelObjects)
}
fetch(
data.url,
url,
{
method: "POST",
headers: {
Expand All @@ -16,13 +21,13 @@ function dalec_fetch_content(container){
},
// cache: "no-cache",
body: JSON.stringify(
{"channelObjects": data.channelObjects, "orderedBy": data.orderedBy}
{"channelObjects": channelObjects, "orderedBy": orderedBy}
),
keepalive: true,
}
).then(function(response){
if (!response.ok) {
console.error(`HTTP error ${response.status} while fetching ${data.url}`);
console.error(`HTTP error ${response.status} while fetching ${url}`);
return ;
}
if (response.status === 204) {
Expand Down

0 comments on commit 1b78471

Please sign in to comment.