fix context error
This commit is contained in:
@@ -1,29 +1,13 @@
|
||||
"use client";
|
||||
import "./style.css";
|
||||
import { useState, createContext, useContext } from "react";
|
||||
import { useState } from "react";
|
||||
import { AuthProvider } from "react-oidc-context";
|
||||
import { oidcConfig, userManager } from "muzak/config/auth";
|
||||
import { Source_Sans_3, Nunito } from "next/font/google";
|
||||
import AuthStatus from "muzak/components/AuthStatus";
|
||||
import NavigationBar from "muzak/components/NavigationBar";
|
||||
import Quota from "muzak/components/Quota";
|
||||
|
||||
interface AnimationContextType {
|
||||
isAnimate: boolean;
|
||||
setIsAnimate: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
}
|
||||
|
||||
const AnimationContext = createContext<AnimationContextType | undefined>(
|
||||
undefined,
|
||||
);
|
||||
|
||||
export const useAnimation = () => {
|
||||
const context = useContext(AnimationContext);
|
||||
if (context === undefined) {
|
||||
throw new Error("useAnimation must be used within an AnimationProvider");
|
||||
}
|
||||
return context;
|
||||
};
|
||||
import { AnimationContext } from "muzak/contexts/AnimationContext";
|
||||
|
||||
const nunito = Nunito({
|
||||
subsets: ["latin"],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { useState } from "react";
|
||||
import { Nunito } from "next/font/google";
|
||||
import { api } from "muzak/data/fetcher";
|
||||
import { useAnimation } from "../layout";
|
||||
import { useAnimation } from "muzak/contexts/AnimationContext";
|
||||
|
||||
const nunito = Nunito({
|
||||
weight: "900",
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
"use client";
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
interface AnimationContextType {
|
||||
isAnimate: boolean;
|
||||
setIsAnimate: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
}
|
||||
|
||||
const AnimationContext = createContext<AnimationContextType | undefined>(
|
||||
undefined,
|
||||
);
|
||||
|
||||
export const useAnimation = () => {
|
||||
const context = useContext(AnimationContext);
|
||||
if (context === undefined) {
|
||||
throw new Error("useAnimation must be used within an AnimationProvider");
|
||||
}
|
||||
return context;
|
||||
};
|
||||
|
||||
export { AnimationContext };
|
||||
Reference in New Issue
Block a user