last update

This commit is contained in:
Ehsan
2025-06-08 10:13:06 +03:30
parent 7d6a9e6e33
commit f52eb43326
13 changed files with 81 additions and 62 deletions
+1
View File
@@ -10,6 +10,7 @@ function Content({ matchedCity, params, logged, initialIsOpenSide, dataUser }) {
const [value, setValue] = useState(Number(params?.sidebar) || 0);
const [isOpenSide, setIsOpenSide] = useState(initialIsOpenSide);
const [isTurnsDetails, setIsTurnsDetails] = useState(false);
console.log(dataUser);
return (
<DashboardPage
+33 -15
View File
@@ -11,6 +11,24 @@ function SendReq({
setIsError,
uuid,
}) {
const handleReq = async () => {
setLoading(true);
request
.getToken(
"mobile",
process.env.NEXT_PUBLIC_CLIENT_ID,
process.env.NEXT_PUBLIC_CLIENT_SECRET,
uuid,
code.join("")
)
.then((response) => {
if (response.access_token) {
handleSetCookie(response);
}
})
.catch(() => {});
};
const handleSetCookie = (response) => {
const accessTokenExpires = new Date();
accessTokenExpires.setSeconds(
@@ -39,28 +57,28 @@ function SendReq({
secure: true,
sameSite: "strict",
});
getInfo(response.access_token);
};
const handleReq = async () => {
setLoading(true);
const getInfo = (token) => {
request
.getToken(
"mobile",
process.env.NEXT_PUBLIC_CLIENT_ID,
process.env.NEXT_PUBLIC_CLIENT_SECRET,
uuid,
code.join("")
)
.then((response) => {
.getUserInfo({
headers: {
Authorization: `Bearer ${token}`,
},
})
.then((res) => {
setLoading(false);
if (response.access_token) {
if (res && res.uuid) {
window.location.pathname = "/";
handleSetCookie(response);
Cookies.set("userInfo", JSON.stringify(res), {
path: "/",
secure: true,
sameSite: "strict",
});
}
})
.catch(() => {
setLoading(false);
});
.catch(() => {});
};
return (