working on user lost for admin
This commit is contained in:
44
frontend/src/routes/user/List.svelte
Normal file
44
frontend/src/routes/user/List.svelte
Normal file
@@ -0,0 +1,44 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
let users = $state([]);
|
||||
|
||||
onMount(async () => {
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/list`;
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
const json = await resp.json();
|
||||
for (let user of json) users.push(user);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<fieldset>
|
||||
<legend>{t('user.list')}</legend>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t('user.id')}</th>
|
||||
<th>{t('user.name')}</th>
|
||||
<th>{t('user.email')}</th>
|
||||
<th>{t('user.language')}</th>
|
||||
<th>{t('user.actions')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each users as u,i}
|
||||
<tr>
|
||||
<td>{u.id}</td>
|
||||
<td>{u.name}</td>
|
||||
<td>{u.email}</td>
|
||||
<td>{u.language}</td>
|
||||
<td>
|
||||
Check permissions, add button here
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
@@ -4,6 +4,7 @@
|
||||
import ClickInput from '../../Components/ClickInput.svelte';
|
||||
import ClickSelect from '../../Components/ClickSelect.svelte';
|
||||
import EditPassword from './EditPassword.svelte';
|
||||
import UserList from './List.svelte';
|
||||
let editPassword = false;
|
||||
|
||||
async function patch(changeset){
|
||||
@@ -92,9 +93,6 @@
|
||||
</fieldset>
|
||||
|
||||
{#if user.permissions.includes('LIST_USERS')}
|
||||
<fieldset>
|
||||
<legend>{t('user.list')}</legend>
|
||||
User list goes here…
|
||||
</fieldset>
|
||||
<UserList />
|
||||
{/if}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user