Fix some obvious things now that the RPC is slightly better.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3957 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-08-13 19:39:29 +00:00
parent d70dba021a
commit fc9c3982c2
10 changed files with 43 additions and 28 deletions

View File

@@ -12,10 +12,20 @@ function delete_user(user) {
}
window.addEventListener('load', function() {
const user_template = (user) => html`<li><button @click=${(e) => delete_user(user)}>Delete</button> ${user}</li>`;
const permission_template = (permission) =>
html` <code>${permission}</code>`;
const user_template = (user, permissions) => html`
<li>
<button @click=${(e) => delete_user(user)}>
Delete
</button>
${user}:
${permissions.map(x => permission_template(x))}
</li>
`;
const users_template = (users) =>
html`<ul>
${users.map(u => user_template(u))}
${users.map(u => user_template(u[0], u[1]))}
</ul>`;
render(users_template(g_data.users), document.body);
render(users_template(Object.entries(g_data.users)), document.body);
});