fix bug structure
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@ import axios from "axios";
|
||||
import { getToken } from "./func";
|
||||
|
||||
const axiosInstance = axios.create({
|
||||
baseURL: import.meta.env.VITE_BASE_URL || "http://localhost:3000/api",
|
||||
baseURL: import.meta.env.VITE_BASE_URL,
|
||||
});
|
||||
|
||||
axiosInstance.interceptors.response.use(
|
||||
|
||||
+6
-10
@@ -7,32 +7,28 @@ export function NumberFormat(number: number): string {
|
||||
return Intl.NumberFormat("fa-IR").format(number);
|
||||
}
|
||||
|
||||
const TOKEN_NAME = import.meta.env.VITE_TOKEN_NAME || "access_token";
|
||||
const REFRESH_TOKEN_NAME =
|
||||
import.meta.env.VITE_REFRESH_TOKEN_NAME || "refresh_token";
|
||||
|
||||
export const getToken = () => {
|
||||
return localStorage.getItem(TOKEN_NAME);
|
||||
return localStorage.getItem(import.meta.env.VITE_TOKEN_NAME);
|
||||
};
|
||||
|
||||
export const getRefreshToken = () => {
|
||||
return localStorage.getItem(REFRESH_TOKEN_NAME);
|
||||
return localStorage.getItem(import.meta.env.VITE_REFRESH_TOKEN_NAME);
|
||||
};
|
||||
|
||||
export const setToken = (token: string) => {
|
||||
localStorage.setItem(TOKEN_NAME, token);
|
||||
localStorage.setItem(import.meta.env.VITE_TOKEN_NAME, token);
|
||||
};
|
||||
|
||||
export const setRefreshToken = (refreshToken: string) => {
|
||||
localStorage.setItem(REFRESH_TOKEN_NAME, refreshToken);
|
||||
localStorage.setItem(import.meta.env.VITE_REFRESH_TOKEN_NAME, refreshToken);
|
||||
};
|
||||
|
||||
export const removeToken = () => {
|
||||
localStorage.removeItem(TOKEN_NAME);
|
||||
localStorage.removeItem(import.meta.env.VITE_TOKEN_NAME);
|
||||
};
|
||||
|
||||
export const removeRefreshToken = () => {
|
||||
localStorage.removeItem(REFRESH_TOKEN_NAME);
|
||||
localStorage.removeItem(import.meta.env.VITE_REFRESH_TOKEN_NAME);
|
||||
};
|
||||
|
||||
export const timeAgo = (date: string | Date): string => {
|
||||
|
||||
Reference in New Issue
Block a user