Spaces:
Sleeping
Sleeping
Download frontend/lib/ToastContext.js from Hans-R-D/Web.Auth.Nexus: direct link, hf CLI and curl.
- Browser
- Download file 483 Bytes
-
https://huggingface.co/spaces/Hans-R-D/Web.Auth.Nexus/resolve/main/frontend/lib/ToastContext.js
- Command line
-
hf download hf://spaces/Hans-R-D/Web.Auth.Nexus/frontend/lib/ToastContext.js
-
curl -L -o ToastContext.js https://huggingface.co/spaces/Hans-R-D/Web.Auth.Nexus/resolve/main/frontend/lib/ToastContext.js
483 Bytes
| 'use client'; | |
| import { createContext, useContext } from "react"; | |
| import { toast } from "react-toastify"; | |
| const ToastContext = createContext(); | |
| export function ToastProvider({ children }) { | |
| return ( | |
| <ToastContext.Provider value={toast}> | |
| {children} | |
| </ToastContext.Provider> | |
| ); | |
| } | |
| export function useToast() { | |
| const context = useContext(ToastContext); | |
| if (!context) { | |
| throw new Error("useToast must be used within a ToastProvider"); | |
| } | |
| return context; | |
| } | |