-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.js
More file actions
27 lines (24 loc) · 835 Bytes
/
functions.js
File metadata and controls
27 lines (24 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
export function openSelector(sidebar, closeBtn, sidebarValue, closeBtnValue) {
sidebar.style.right = sidebarValue;
closeBtn.style.right = closeBtnValue;
}
export async function getPosts(ref) {
const rawData = await fetch(
`https://digikids.cdn.prismic.io/api/v2/documents/search?ref=${ref}`
);
const data = await rawData.json();
return data.results;
}
export async function getApi() {
const rawApi = await fetch("https://digikids.cdn.prismic.io/api/v2/");
const api = await rawApi.json();
var masterRefObj = api.refs.find((refs) => refs.id === "master");
var masterRef = masterRefObj.ref;
return masterRef;
}
export function makeCards(cards, numberOfCards) {
for (let i = 0; i < numberOfCards; i++) {
var clone = cards[0].cloneNode(true);
cards[0].insertAdjacentElement("afterend", clone);
}
}