mirror of
https://github.com/khairul169/garage-webui.git
synced 2026-09-18 18:27:39 +07:00
feat: add bucket browser
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { createContext, useContext } from "react";
|
||||
import { Bucket } from "../types";
|
||||
|
||||
export const BucketContext = createContext<{
|
||||
bucket: Bucket;
|
||||
refetch: () => void;
|
||||
bucketName: string;
|
||||
} | null>(null);
|
||||
|
||||
export const useBucketContext = () => {
|
||||
const bucket = useContext(BucketContext);
|
||||
if (!bucket) {
|
||||
throw new Error(
|
||||
"BucketContext must be used within a BucketContextProvider"
|
||||
);
|
||||
}
|
||||
|
||||
return bucket;
|
||||
};
|
||||
Reference in New Issue
Block a user