Skip to content

Commit

Permalink
work on childrendata skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
MaHaWo committed Aug 26, 2024
1 parent 0e4087a commit dfd3d6f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/lib/stores/childrenData.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,23 @@ let childrenlist = {};

const childrenData = writable(childrenlist);

function addChildrenData(data, usertoken) {}
async function addChildrenData(data, usertoken) {
childrenData.update((childrenlist) => {
if (usertoken in childrenlist) {
childrenlist[usertoken] = data;
} else {
childrenlist[usertoken] = {};
childrenlist[usertoken][data.token] = data;
}
});
}

function removeChildrenData(usertoken) {}
async function removeChildrenData(usertoken, childtoken) {
childrenData.update((childrenlist) => {
if (usertoken in childrenlist) {
delete childrenlist[usertoken][childtoken];
}
});
}

export { addChildrenData, childrenData, removeChildrenData };

0 comments on commit dfd3d6f

Please sign in to comment.