no cache handler added
This commit was merged in pull request #861.
This commit is contained in:
@@ -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>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user