Skip to content

Commit

Permalink
load default set, if not authenticated
Browse files Browse the repository at this point in the history
  • Loading branch information
delanni authored Nov 14, 2024
1 parent 9fa7712 commit c133eae
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion bundle.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -47702,7 +47702,30 @@

return;
} else {
console.warn("Amakit is not defined, or is not authenticated", window.amakit);
console.warn("Amakit is not defined, or is not authenticated - loading default sketch set", window.amakit);
fetch("sketches.json")
.then(r=>r.json(), () => [])
.then(data => {
downloadedSketches = data.map(d=> {
const code = d.type=='url'
? parseCode(d.url)
: d.code;

return {
...d,
code,
local: false,
}
})

// Merge by name
const sketches = {};
downloadedSketches.concat(localSketches).forEach(s => {
// Local sketches override remote
sketches[s.name] = s;
});
mySketches = Object.values(sketches);
}).catch(err => { console.error('cannot fetch sketches.json', err) });
}
});

Expand Down

0 comments on commit c133eae

Please sign in to comment.