feat: add user from admin panel

This commit is contained in:
Timothy J. Baek
2024-05-01 18:06:02 -07:00
parent 96af34f240
commit e6bcdba5ad
5 changed files with 36 additions and 8 deletions

View File

@@ -15,9 +15,18 @@
name: '',
email: '',
password: '',
role: ''
role: 'pending'
};
$: if (show) {
_user = {
name: '',
email: '',
password: '',
role: 'pending'
};
}
const submitHandler = async () => {
const res = await addUser(
localStorage.token,
@@ -38,7 +47,7 @@
<Modal size="sm" bind:show>
<div>
<div class=" flex justify-between dark:text-gray-300 px-5 pt-4 pb-3">
<div class=" flex justify-between dark:text-gray-300 px-5 pt-4 pb-2">
<div class=" text-lg font-medium self-center">{$i18n.t('Add User')}</div>
<button
class="self-center"
@@ -69,6 +78,23 @@
>
<div class=" ">
<div class="flex flex-col w-full">
<div class=" mb-1 text-xs text-gray-500">{$i18n.t('Role')}</div>
<div class="flex-1">
<select
class="w-full capitalize rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 disabled:text-gray-500 dark:disabled:text-gray-500 outline-none"
bind:value={_user.role}
placeholder={$i18n.t('Enter Your Role')}
required
>
<option value="pending"> pending </option>
<option value="user"> user </option>
<option value="admin"> admin </option>
</select>
</div>
</div>
<div class="flex flex-col w-full mt-2">
<div class=" mb-1 text-xs text-gray-500">{$i18n.t('Name')}</div>
<div class="flex-1">