fix login
This commit is contained in:
parent
0b00da4b0d
commit
db5a733752
@ -1,5 +1,3 @@
|
|||||||
"use server";
|
|
||||||
|
|
||||||
import ProfileAvatar from "@/features/ProfileAvatar/ProfileAvatar";
|
import ProfileAvatar from "@/features/ProfileAvatar/ProfileAvatar";
|
||||||
import { apiInstance } from "@/shared/config/apiConfig";
|
import { apiInstance } from "@/shared/config/apiConfig";
|
||||||
import { authConfig } from "@/shared/config/authConfig";
|
import { authConfig } from "@/shared/config/authConfig";
|
||||||
|
@ -51,19 +51,19 @@ export const authConfig: AuthOptions = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const res = await apiInstance.post<ITokens>("/auth/login/", data);
|
const res = await apiInstance.post<ITokens>("/auth/login/", data);
|
||||||
|
console.log(res);
|
||||||
if ([200, 201].includes(res.status)) {
|
if ([200, 201].includes(res.status)) {
|
||||||
const currentTime = new Date();
|
// const currentTime = new Date();
|
||||||
const expirationTime = new Date(currentTime.getTime() + 14 * 60000);
|
// const expirationTime = new Date(currentTime.getTime() + 14 * 60000);
|
||||||
expirationTime.setTime(
|
// expirationTime.setTime(
|
||||||
expirationTime.getTime() +
|
// expirationTime.getTime() +
|
||||||
expirationTime.getTimezoneOffset() * 60 * 1000 * -1
|
// expirationTime.getTimezoneOffset() * 60 * 1000 * -1
|
||||||
);
|
// );
|
||||||
|
|
||||||
const user = {
|
const user = {
|
||||||
refresh_token: res.data.refresh_token,
|
refresh_token: res.data.refresh_token,
|
||||||
access_token: res.data.access_token,
|
access_token: res.data.access_token,
|
||||||
expires_in: expirationTime,
|
expires_in: res.data.expires_in,
|
||||||
};
|
};
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
|
Loading…
Reference in New Issue
Block a user