i might be dong this icorrectly, if so, please tell me:
i connected the KV to my worker in the toml file. that also shows up on cloudflare's website. whenever the user sends json data, it should get written:
const requestData = await request.json()
currentUsername = requestData.name;
if (acceptedNames.includes(requestData.name)) {
acceptedEntry = true;
var m = new Map();
for (let i = 0; i < requestData.array.length; i += 2) {
m[requestData.array[i]] = requestData.array[i + 1];
}
env.GROUP_CAL.put(requestData.name, m);
groupCal.set(requestData.name, m);
} else acceptedEntry = false;
even though requestData is defined, and groupCal gets written to, it seems like GROUP_CAL isnt getting written to, since when returning the new site (or even retrieving it a couple minutes after the put), and writing from
GROUP_CAL to groupCal, the result is always {}:
for (const name of acceptedNames) {
let val = await env.GROUP_CAL.get(name);
if (val !== null) {
groupCal[name] = val;
} else console.log(name + " has no data.");
}
what am i doing wrong?