Browse Source

perf: 补充注释

xiaoxian521 2 years ago
parent
commit
cadd611559
2 changed files with 3 additions and 3 deletions
  1. 2 2
      build/index.ts
  2. 1 1
      src/utils/auth.ts

+ 2 - 2
build/index.ts

@@ -1,6 +1,6 @@
 /** 处理环境变量 */
 const warpperEnv = (envConf: Recordable): ViteEnv => {
-  /** 此处为默认值,无需修改 */
+  /** 此处为默认值 */
   const ret: ViteEnv = {
     VITE_PORT: 8848,
     VITE_PUBLIC_PATH: "",
@@ -28,7 +28,7 @@ const warpperEnv = (envConf: Recordable): ViteEnv => {
   return ret;
 };
 
-/** 环境变量 */
+/** 获取环境变量 */
 const loadEnv = (): ViteEnv => {
   return import.meta.env;
 };

+ 1 - 1
src/utils/auth.ts

@@ -35,7 +35,7 @@ export function getToken(): DataInfo<number> {
 export function setToken(data: DataInfo<Date>) {
   let expires = 0;
   const { accessToken, refreshToken } = data;
-  expires = new Date(data.expires).getTime();
+  expires = new Date(data.expires).getTime(); // 如果后端直接设置时间戳,将此处代码改为expires = data.expires,然后把上面的DataInfo<Date>改成DataInfo<number>即可
   const cookieString = JSON.stringify({ accessToken, expires });
 
   expires > 0