mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 12:08:28 +00:00
feat: can now load samples via url
This commit is contained in:
parent
240a8930ef
commit
cf7c734778
@ -102,7 +102,13 @@ export const loadGithubSamples = async (path, nameFn) => {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const samples = (sampleMap, baseUrl = sampleMap._base || '') => {
|
export const samples = async (sampleMap, baseUrl = sampleMap._base || '') => {
|
||||||
|
if (typeof sampleMap === 'string') {
|
||||||
|
const base = sampleMap.split('/').slice(0, -1).join('/');
|
||||||
|
return fetch(sampleMap)
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((json) => samples(json, json._base || base));
|
||||||
|
}
|
||||||
sampleCache.current = {
|
sampleCache.current = {
|
||||||
...sampleCache.current,
|
...sampleCache.current,
|
||||||
...Object.fromEntries(
|
...Object.fromEntries(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user