13 lines
375 B
TypeScript
13 lines
375 B
TypeScript
import { useContext } from "react";
|
|
import { TransportContext } from "./TransportProvider";
|
|
|
|
|
|
export function useTransport() {
|
|
const context = useContext(TransportContext);
|
|
if(!context){
|
|
throw new Error("useTransport must be used within a TransportProvider");
|
|
}
|
|
const { uploadFile, downloadFile } = context;
|
|
|
|
return { downloadFile, uploadFile };
|
|
} |