no cache handler added

This commit was merged in pull request #861.
This commit is contained in:
victorAnumudu
2024-11-30 09:39:12 +01:00
parent 6e97121f96
commit 5d05da30ca
7 changed files with 111 additions and 41 deletions
+7 -5
View File
@@ -6,6 +6,8 @@ import axios from 'axios'
function Default({ children }) {
const location = useLocation()
const [nocache, setNoCache] = useState(false) // holds cache/nocache value
// dark mode setup
const [theme, setTheme] = useState(null);
@@ -16,6 +18,10 @@ function Default({ children }) {
const queryParams = new URLSearchParams(location?.search);
const country = queryParams.get("cnt")?.toUpperCase();
const handleThemeSwitch = () => {
setTheme(theme === "dark" ? "light" : "dark");
};
const getLocation = () => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
@@ -58,10 +64,6 @@ function Default({ children }) {
}
}, [theme]);
const handleThemeSwitch = () => {
setTheme(theme === "dark" ? "light" : "dark");
};
useEffect(()=>{
if(country){
setCountryMode(country)
@@ -75,7 +77,7 @@ function Default({ children }) {
return (
<>
<DarkModeContext.Provider value={{ theme, handleThemeSwitch, countryMode }}>
<DarkModeContext.Provider value={{ theme, handleThemeSwitch, countryMode, nocache, setNoCache }}>
{children && children}
</DarkModeContext.Provider>
</>