=> {
+ await localforage.removeItem(key)
+ },
+ clear: async () => {
+ return await localforage.clear()
+ },
+ createInstance: async (name: string) => {
+ return localforage.createInstance({
+ name,
+ })
+ },
+}
diff --git a/src/views/Home/index.tsx b/src/views/Home/index.tsx
index da7604c..9994cd2 100644
--- a/src/views/Home/index.tsx
+++ b/src/views/Home/index.tsx
@@ -1,17 +1,16 @@
-// import FileSharing from '@/components/FileSharing'
-// import DefaultLayOut from '@/layout/default'
-
import HomeIndex from '@/components/HomeIndex'
-
-// import Loading from '@/components/Loading'
+import { useEffect } from 'react'
+import { handleLocalforage } from '@/utils/localforage'
export default () => {
+ useEffect(() => {
+ handleLocalforage.getItem('token').then((res: any) => {
+ console.log(JSON.parse(res))
+ })
+ }, [])
return (
- {/**/}
- {/**/}
- {/**/}
)
}
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index 7985ae1..b316ff0 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -6,6 +6,8 @@ declare interface ImportMetaEnv {
readonly VITE_API_BASE_URL: string
readonly VITE_NODE_ENV: string
readonly VITE_TITLE_NAME: string
+ readonly VITE_APP_TOKEN_KEY?: string
+ readonly VITE_UPLOAD_URL?: string
}
interface ImportMeta {
diff --git a/vite.config.ts b/vite.config.ts
index a81192d..59b4389 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -159,5 +159,16 @@ export default defineConfig(({ mode }) => {
},
},
},
+ server: {
+ proxy: {
+ [env.VITE_APP_BASE_API]: {
+ //后端接口的baseurl
+ target: env.VITE_API_BASE_URL,
+ //是否允许跨域
+ changeOrigin: true,
+ rewrite: (path) => path.replace(RegExp(`^${env.VITE_APP_BASE_API}`), ''),
+ },
+ },
+ },
}
})