refactor: restructure pinia stores, fix calendar, add utilities
- Restructure Pinia store organization from src/stores/ to src/store/ with modular stores - Update main.ts to use locally created Pinia instance instead of imported pre-configured one - Fix template syntax errors in Calendar component: correct missing class spacing and incorrect closing tags - Remove unused calendar demo/example files and documentation - Add new constant files, token management utilities, and client configuration constants - Add custom hooks useGoHome and useGoLogin for navigation and login logic
This commit is contained in:
35
src/constants/token.ts
Normal file
35
src/constants/token.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { currentClientType } from "@/constant/base";
|
||||
|
||||
// 存储在本地的认证 token 键名
|
||||
const CLIENT_TYPE = currentClientType();
|
||||
const ACCESS_TOKEN = `${CLIENT_TYPE}_ACCESS_TOKEN`;
|
||||
const REFRESH_ACCESS_TOKEN = `${CLIENT_TYPE}_REFRESH_ACCESS_TOKEN`;
|
||||
|
||||
// 设置本地存储的认证 token
|
||||
export const setAccessToken = (token) => {
|
||||
return uni.setStorageSync(ACCESS_TOKEN, token);
|
||||
};
|
||||
|
||||
// 设置本地存储的刷新 token
|
||||
export const setRefreshToken = (token) => {
|
||||
return uni.setStorageSync(REFRESH_ACCESS_TOKEN, token);
|
||||
};
|
||||
|
||||
// 获取本地存储的刷新 token
|
||||
export const getRefreshToken = () => {
|
||||
return uni.getStorageSync(REFRESH_ACCESS_TOKEN);
|
||||
};
|
||||
|
||||
// 获取本地存储的认证 token
|
||||
export const getAccessToken = () => {
|
||||
return uni.getStorageSync(ACCESS_TOKEN);
|
||||
};
|
||||
|
||||
// 移除本地存储的认证 token
|
||||
export const removeAccessToken = () => {
|
||||
return uni.removeStorageSync(ACCESS_TOKEN);
|
||||
};
|
||||
|
||||
export const removeRefreshToken = () => {
|
||||
return uni.removeStorageSync(REFRESH_ACCESS_TOKEN);
|
||||
};
|
||||
Reference in New Issue
Block a user