wip: refactor
This commit is contained in:
10
packages/ark/src/hooks/useArk.ts
Normal file
10
packages/ark/src/hooks/useArk.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { useContext } from "react";
|
||||
import { ArkContext } from "../context";
|
||||
|
||||
export const useArk = () => {
|
||||
const context = useContext(ArkContext);
|
||||
if (context === undefined) {
|
||||
throw new Error("useArk must be used within an ArkProvider");
|
||||
}
|
||||
return context;
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useArk } from "../provider";
|
||||
import { useArk } from "./useArk";
|
||||
|
||||
export function useEvent(id: string) {
|
||||
const ark = useArk();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useArk } from "../provider";
|
||||
import { useArk } from "./useArk";
|
||||
|
||||
export function useProfile(pubkey: string) {
|
||||
const ark = useArk();
|
||||
|
||||
Reference in New Issue
Block a user