Skip to content

Commit

Permalink
loading
Browse files Browse the repository at this point in the history
  • Loading branch information
heyvard committed May 25, 2024
1 parent 77dc673 commit efbb239
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/pages/brukere.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { UseMutateUser } from '../queries/mutateUser'

const Brukere: NextPage = () => {
const { data } = UseUsers()
const muteteUser = UseMutateUser()
const { mutate, isPending } = UseMutateUser()

if (!data) {
return <Spinner />
Expand Down Expand Up @@ -36,9 +36,11 @@ const Brukere: NextPage = () => {
<Button
type={'button'}
variant={'danger'}
loading={isPending}

size={'xsmall'}
onClick={() =>
muteteUser.mutate({
mutate({
id: user.id,
request: { active: false },
})
Expand All @@ -51,9 +53,11 @@ const Brukere: NextPage = () => {
<Button
type={'button'}
variant={'secondary'}
loading={isPending}

size={'xsmall'}
onClick={() =>
muteteUser.mutate({
mutate({
id: user.id,
request: { active: true },
})
Expand All @@ -66,8 +70,10 @@ const Brukere: NextPage = () => {
<Table.DataCell>
<Switch
checked={user.admin}
loading={isPending}

onChange={() =>
muteteUser.mutate({
mutate({
id: user.id,
request: { admin: !user.admin },
})
Expand All @@ -79,8 +85,9 @@ const Brukere: NextPage = () => {
<Table.DataCell align="right">
<Switch
checked={user.paid}
loading={isPending}
onChange={() =>
muteteUser.mutate({
mutate({
id: user.id,
request: { paid: !user.paid },
})
Expand Down

0 comments on commit efbb239

Please sign in to comment.