optimize: ♻️ 修改http请求分类
This commit is contained in:
parent
f85acf9217
commit
f267e5e042
|
@ -8,9 +8,9 @@ import type {
|
||||||
PureHttpRequestConfig,
|
PureHttpRequestConfig,
|
||||||
PureHttpResponse,
|
PureHttpResponse,
|
||||||
RequestMethods
|
RequestMethods
|
||||||
} from "./types.d";
|
} from "./types";
|
||||||
import { stringify } from "qs";
|
import { stringify } from "qs";
|
||||||
import NProgress from "../progress";
|
import NProgress from "../../utils/progress";
|
||||||
import { formatToken, getToken } from "@/utils/auth";
|
import { formatToken, getToken } from "@/utils/auth";
|
||||||
import { useUserStoreHook } from "@/store/modules/user";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
|
|
|
@ -8,9 +8,9 @@ import type {
|
||||||
PureHttpRequestConfig,
|
PureHttpRequestConfig,
|
||||||
PureHttpResponse,
|
PureHttpResponse,
|
||||||
RequestMethods
|
RequestMethods
|
||||||
} from "./types.d";
|
} from "./types";
|
||||||
import { stringify } from "qs";
|
import { stringify } from "qs";
|
||||||
import NProgress from "../progress";
|
import NProgress from "../../utils/progress";
|
||||||
import { formatToken, getToken } from "@/utils/auth";
|
import { formatToken, getToken } from "@/utils/auth";
|
||||||
import { useUserStoreHook } from "@/store/modules/user";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { http } from "@/utils/http/mockRequest";
|
import { http } from "@/api/service/mockRequest";
|
||||||
|
|
||||||
type Result = {
|
type Result = {
|
||||||
success: boolean;
|
success: boolean;
|
|
@ -1,4 +1,4 @@
|
||||||
import { http } from "@/utils/http/mockRequest";
|
import { http } from "@/api/service/mockRequest";
|
||||||
|
|
||||||
export type UserResult = {
|
export type UserResult = {
|
||||||
success: boolean;
|
success: boolean;
|
|
@ -1,34 +1,34 @@
|
||||||
import {
|
import {
|
||||||
type RouterHistory,
|
createWebHashHistory,
|
||||||
type RouteRecordRaw,
|
|
||||||
type RouteComponent,
|
|
||||||
createWebHistory,
|
createWebHistory,
|
||||||
createWebHashHistory
|
type RouteComponent,
|
||||||
|
type RouteRecordRaw,
|
||||||
|
type RouterHistory
|
||||||
} from "vue-router";
|
} from "vue-router";
|
||||||
import { router } from "./index";
|
import { router } from "./index";
|
||||||
import { isProxy, toRaw } from "vue";
|
import { isProxy, toRaw } from "vue";
|
||||||
import { useTimeoutFn } from "@vueuse/core";
|
import { useTimeoutFn } from "@vueuse/core";
|
||||||
import {
|
import {
|
||||||
isString,
|
|
||||||
cloneDeep,
|
cloneDeep,
|
||||||
isAllEmpty,
|
|
||||||
intersection,
|
intersection,
|
||||||
storageLocal,
|
isAllEmpty,
|
||||||
isIncludeAllChildren
|
isIncludeAllChildren,
|
||||||
|
isString,
|
||||||
|
storageLocal
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
import { buildHierarchyTree } from "@/utils/tree";
|
import { buildHierarchyTree } from "@/utils/tree";
|
||||||
import { userKey, type DataInfo } from "@/utils/auth";
|
import { type DataInfo, userKey } from "@/utils/auth";
|
||||||
import { type menuType, routerArrays } from "@/layout/types";
|
import { type menuType, routerArrays } from "@/layout/types";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
|
// 动态路由
|
||||||
|
import { getAsyncRoutes } from "@/api/v1/routes";
|
||||||
|
|
||||||
const IFrame = () => import("@/layout/frame.vue");
|
const IFrame = () => import("@/layout/frame.vue");
|
||||||
// https://cn.vitejs.dev/guide/features.html#glob-import
|
// https://cn.vitejs.dev/guide/features.html#glob-import
|
||||||
const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
|
const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
|
||||||
|
|
||||||
// 动态路由
|
|
||||||
import { getAsyncRoutes } from "@/api/routes";
|
|
||||||
|
|
||||||
function handRank(routeInfo: any) {
|
function handRank(routeInfo: any) {
|
||||||
const { name, path, parentId, meta } = routeInfo;
|
const { name, path, parentId, meta } = routeInfo;
|
||||||
return isAllEmpty(parentId)
|
return isAllEmpty(parentId)
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import {
|
import {
|
||||||
type userType,
|
|
||||||
store,
|
|
||||||
router,
|
|
||||||
resetRouter,
|
resetRouter,
|
||||||
|
router,
|
||||||
routerArrays,
|
routerArrays,
|
||||||
storageLocal
|
storageLocal,
|
||||||
|
store,
|
||||||
|
type userType
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
import {
|
import {
|
||||||
type UserResult,
|
|
||||||
type RefreshTokenResult,
|
|
||||||
getLogin,
|
getLogin,
|
||||||
refreshTokenApi
|
refreshTokenApi,
|
||||||
} from "@/api/user";
|
type RefreshTokenResult,
|
||||||
|
type UserResult
|
||||||
|
} from "@/api/v1/user";
|
||||||
import { useMultiTagsStoreHook } from "./multiTags";
|
import { useMultiTagsStoreHook } from "./multiTags";
|
||||||
import { type DataInfo, setToken, removeToken, userKey } from "@/utils/auth";
|
import { type DataInfo, removeToken, setToken, userKey } from "@/utils/auth";
|
||||||
|
|
||||||
export const useUserStore = defineStore({
|
export const useUserStore = defineStore({
|
||||||
id: "pure-user",
|
id: "pure-user",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import { useUserStoreHook } from "@/store/modules/user";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
import { storageLocal, isString, isIncludeAllChildren } from "@pureadmin/utils";
|
import { isIncludeAllChildren, isString, storageLocal } from "@pureadmin/utils";
|
||||||
|
|
||||||
export interface DataInfo<T> {
|
export interface DataInfo<T> {
|
||||||
/** token */
|
/** token */
|
||||||
|
|
Loading…
Reference in New Issue