Skip to content

Commit

Permalink
Add loading indicator to create module button (#329)
Browse files Browse the repository at this point in the history
* Add loading indicator to create module button

* Fix formatting

---------

Co-authored-by: Ahmed Elsakaan <[email protected]>
  • Loading branch information
BlueZeeKing and ixahmedxi authored Oct 31, 2023
1 parent 90ffc5d commit eda57dd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/(dashboard)/_components/side-menu-modules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const CreateModulePopover = () => {

const utils = trpc.useUtils();

const { mutateAsync } = trpc.module.post.create.useMutation({
const { mutateAsync, isLoading } = trpc.module.post.create.useMutation({
onSuccess: async () => {
await utils.module.get.all.invalidate();
},
Expand Down Expand Up @@ -362,7 +362,12 @@ const CreateModulePopover = () => {
<span className="text-default-500">Color</span>
</Button>

<Button type="submit" color="primary" className="font-semibold">
<Button
isLoading={isLoading}
type="submit"
color="primary"
className="font-semibold"
>
Create module
</Button>
</>
Expand Down

0 comments on commit eda57dd

Please sign in to comment.