Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f4c0c5bf15 | |||
| a4b85e9c85 | |||
| 6dab5412c7 | |||
| 4949bd28aa |
@@ -1,5 +1,6 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import DarkModeContext from "../Contexts/DarkModeContext";
|
import DarkModeContext from "../Contexts/DarkModeContext";
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
function Default({ children }) {
|
function Default({ children }) {
|
||||||
// dark mode setup
|
// dark mode setup
|
||||||
@@ -12,6 +13,32 @@ function Default({ children }) {
|
|||||||
const queryParams = new URLSearchParams(location?.search);
|
const queryParams = new URLSearchParams(location?.search);
|
||||||
const country = queryParams.get("cnt")?.toUpperCase();
|
const country = queryParams.get("cnt")?.toUpperCase();
|
||||||
|
|
||||||
|
const getLocation = () => {
|
||||||
|
if (navigator.geolocation) {
|
||||||
|
navigator.geolocation.getCurrentPosition(
|
||||||
|
(data) => {
|
||||||
|
const pos = data.coords;
|
||||||
|
const position = {
|
||||||
|
lat: pos.latitude,
|
||||||
|
long: pos.longitude,
|
||||||
|
};
|
||||||
|
axios.get(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${position.lat}&lon=${position.long}&zoom=18&addressdetails=1`).then(res =>{
|
||||||
|
localStorage.setItem("myloc", res?.data?.address?.country);
|
||||||
|
// console.log('LOC', res?.data?.address?.country)
|
||||||
|
// localStorage.setItem("myloc", JSON.stringify(position));
|
||||||
|
}).catch(err => {
|
||||||
|
console.log('ERR', err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
localStorage.setItem("myloc", JSON.stringify('not supported'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
localStorage.setItem("myloc", JSON.stringify('not supported'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
||||||
setTheme("dark");
|
setTheme("dark");
|
||||||
@@ -39,6 +66,10 @@ function Default({ children }) {
|
|||||||
}
|
}
|
||||||
},[countryMode])
|
},[countryMode])
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
getLocation()
|
||||||
|
},[])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DarkModeContext.Provider value={{ theme, handleThemeSwitch, countryMode }}>
|
<DarkModeContext.Provider value={{ theme, handleThemeSwitch, countryMode }}>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class usersService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
blogData() {
|
blogData() {
|
||||||
return this.getAuxEnd("/blogdata", null);
|
return this.getAuxEnd("/blogdata", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
CompleteOauthLogin(reqData) {
|
CompleteOauthLogin(reqData) {
|
||||||
@@ -130,7 +130,7 @@ class usersService {
|
|||||||
}
|
}
|
||||||
getApiGate() {
|
getApiGate() {
|
||||||
// localStorage.setItem("session_token", ``);
|
// localStorage.setItem("session_token", ``);
|
||||||
return this.postAuxEnd("/apigate", null);
|
return this.postAuxEnd("/apigate", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
getLoadProfile() {
|
getLoadProfile() {
|
||||||
@@ -141,7 +141,7 @@ class usersService {
|
|||||||
page: 0,
|
page: 0,
|
||||||
limit: 100,
|
limit: 100,
|
||||||
};
|
};
|
||||||
return this.postAuxEnd("/loadprofile", null);
|
return this.postAuxEnd("/loadprofile", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
getUploadedList() {
|
getUploadedList() {
|
||||||
@@ -791,7 +791,7 @@ class usersService {
|
|||||||
|
|
||||||
// Country Data {GET}
|
// Country Data {GET}
|
||||||
getSignupCountryData() {
|
getSignupCountryData() {
|
||||||
return this.postAuxEnd("/signupcountry", null);
|
return this.postAuxEnd("/signupcountry", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
// END POINT TO GET BANK NAME
|
// END POINT TO GET BANK NAME
|
||||||
@@ -1529,7 +1529,7 @@ class usersService {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
getUserReminders() {
|
getUserReminders() {
|
||||||
return this.getAuxEnd("/reminders", null);
|
return this.getAuxEnd("/reminders", {});
|
||||||
}
|
}
|
||||||
//---------------------------------------- -----
|
//---------------------------------------- -----
|
||||||
//---------------------------------------- -----
|
//---------------------------------------- -----
|
||||||
@@ -1588,6 +1588,9 @@ class usersService {
|
|||||||
// Axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*'; //,axiosConfig
|
// Axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*'; //,axiosConfig
|
||||||
// Axios.defaults.withCredentials = true;
|
// Axios.defaults.withCredentials = true;
|
||||||
//debugger;
|
//debugger;
|
||||||
|
if(localStorage && localStorage.getItem('myloc')){
|
||||||
|
reqData.loc = localStorage.getItem('myloc')
|
||||||
|
}
|
||||||
return Axios.post(endPoint, reqData)
|
return Axios.post(endPoint, reqData)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|||||||
Reference in New Issue
Block a user