Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
feat: Export useAction hook for handling async actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nonoakij committed May 23, 2024
1 parent a3983b9 commit cf04686
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/solution/hooks/useAction.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from "react";

// biome-ignore lint/suspicious/noExplicitAny: <explanation>
function useAction<T extends (arg: any) => Promise<any>>(action: T) {
export function useAction<T extends (arg: any) => Promise<any>>(action: T) {
const [isLoading, setIsLoading] = useState(false);
const dispatch = async (arg: Parameters<T>) => {
setIsLoading(true);
Expand Down
2 changes: 1 addition & 1 deletion apps/workspace/hooks/useAction.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from "react";

// biome-ignore lint/suspicious/noExplicitAny: <explanation>
function useAction<T extends (arg: any) => Promise<any>>(action: T) {
export function useAction<T extends (arg: any) => Promise<any>>(action: T) {
const [isLoading, setIsLoading] = useState(false);
const dispatch = async (arg: Parameters<T>) => {
setIsLoading(true);
Expand Down

0 comments on commit cf04686

Please sign in to comment.