mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-06-09 06:29:53 +02:00
update users table
This commit is contained in:
parent
ef0df9aa02
commit
bcc9432f95
@ -2,7 +2,7 @@ import { type User } from 'wasp/entities';
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { cn } from '../../../client/cn';
|
import { cn } from '../../../client/cn';
|
||||||
|
|
||||||
const SwitcherOne = ({ user, updateUserById }: { user?: Partial<User>; updateUserById?: any }) => {
|
const SwitcherOne = ({ user, updateIsUserAdminById }: { user?: Partial<User>; updateIsUserAdminById?: any }) => {
|
||||||
const [enabled, setEnabled] = useState<boolean>(user?.isAdmin || false);
|
const [enabled, setEnabled] = useState<boolean>(user?.isAdmin || false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -15,7 +15,7 @@ const SwitcherOne = ({ user, updateUserById }: { user?: Partial<User>; updateUse
|
|||||||
className='sr-only'
|
className='sr-only'
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
setEnabled(!enabled);
|
setEnabled(!enabled);
|
||||||
updateUserById && updateUserById({ id: user?.id, data: { isAdmin: !enabled } });
|
updateIsUserAdminById && updateIsUserAdminById({ id: user?.id, data: { isAdmin: !enabled } });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div className='reblock h-8 w-14 rounded-full bg-meta-9 dark:bg-[#5A616B]'></div>
|
<div className='reblock h-8 w-14 rounded-full bg-meta-9 dark:bg-[#5A616B]'></div>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { type SubscriptionStatus } from '../../../payment/plans';
|
import { type SubscriptionStatus } from '../../../payment/plans';
|
||||||
import { updateUserById, useQuery, getPaginatedUsers } from 'wasp/client/operations';
|
import { updateIsUserAdminById, useQuery, getPaginatedUsers } from 'wasp/client/operations';
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import SwitcherOne from './SwitcherOne';
|
import SwitcherOne from './SwitcherOne';
|
||||||
import LoadingSpinner from '../../layout/LoadingSpinner';
|
import LoadingSpinner from '../../layout/LoadingSpinner';
|
||||||
@ -226,7 +226,7 @@ const UsersTable = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className='col-span-1 flex items-center'>
|
<div className='col-span-1 flex items-center'>
|
||||||
<div className='text-sm text-black dark:text-white'>
|
<div className='text-sm text-black dark:text-white'>
|
||||||
<SwitcherOne user={user} updateUserById={updateUserById} />
|
<SwitcherOne user={user} updateIsUserAdminById={updateIsUserAdminById} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='col-span-1 flex items-center'>
|
<div className='col-span-1 flex items-center'>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user