fix: 适配上游 PageQuery 与登录跳转签名并修复弹窗配置类型报错
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { BaseQueryParams } from "@/api/common";
|
||||
import type { PageQuery } from "@/api/common";
|
||||
|
||||
/** 应用图标分页查询参数 */
|
||||
export interface AppIconQuery extends BaseQueryParams {
|
||||
export interface AppIconQuery extends PageQuery {
|
||||
/** 应用包名(可选,不传则返回全部) */
|
||||
packageName?: string;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
* Developer 设备开发者选项类型定义
|
||||
*/
|
||||
|
||||
import type { BaseQueryParams } from "@/api/common";
|
||||
import type { PageQuery } from "@/api/common";
|
||||
|
||||
/** 开发者选项分页查询参数 */
|
||||
export interface DeveloperQueryParams extends BaseQueryParams {
|
||||
export interface DeveloperQueryParams extends PageQuery {
|
||||
/** 搜索关键字(设备序列号) */
|
||||
keywords?: string;
|
||||
/** 开发者选项开关(0关闭,1开启) */
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Device 用户类型定义
|
||||
*/
|
||||
|
||||
import type { BaseQueryParams } from "@/api/common";
|
||||
import type { PageQuery } from "@/api/common";
|
||||
|
||||
/** 登录用户信息 */
|
||||
export interface DeviceInfo {
|
||||
@@ -23,7 +23,7 @@ export interface DeviceInfo {
|
||||
}
|
||||
|
||||
/** 用户分页查询参数 */
|
||||
export interface DeviceQueryParams extends BaseQueryParams {
|
||||
export interface DeviceQueryParams extends PageQuery {
|
||||
/** 搜索关键字 */
|
||||
keywords?: string;
|
||||
/** 用户状态 */
|
||||
|
||||
@@ -30,8 +30,8 @@ function usePage() {
|
||||
// 编辑
|
||||
async function handleEditClick(
|
||||
row: IObject,
|
||||
callback?: (result?: IObject) => IObject,
|
||||
RefImpl?: Ref<PageModalInstance>
|
||||
callback?: (result?: IObject) => IObject | Promise<IObject>,
|
||||
RefImpl?: Ref<PageModalInstance>,
|
||||
) {
|
||||
if (RefImpl) {
|
||||
RefImpl.value?.setModalVisible();
|
||||
@@ -48,8 +48,8 @@ function usePage() {
|
||||
// 查看
|
||||
async function handleViewClick(
|
||||
row: IObject,
|
||||
callback?: (result?: IObject) => IObject,
|
||||
RefImpl?: Ref<PageModalInstance>
|
||||
callback?: (result?: IObject) => IObject | Promise<IObject>,
|
||||
RefImpl?: Ref<PageModalInstance>,
|
||||
) {
|
||||
if (RefImpl) {
|
||||
RefImpl.value?.setModalVisible();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import axios, { type AxiosResponse } from "axios";
|
||||
import axios, { type AxiosResponse, type InternalAxiosRequestConfig } from "axios";
|
||||
import qs from "qs";
|
||||
|
||||
import { ApiCodeEnum } from "@/enums/api";
|
||||
@@ -91,7 +91,7 @@ function setupInterceptors(instance: typeof http) {
|
||||
// Token 过期
|
||||
if (code === ApiCodeEnum.ACCESS_TOKEN_INVALID) {
|
||||
if (!config || retriedRequests.has(config)) {
|
||||
await useUserStoreHook().redirectToLogin("expired");
|
||||
await useUserStoreHook().redirectToLogin();
|
||||
return Promise.reject(new Error("Token Invalid"));
|
||||
}
|
||||
|
||||
@@ -108,14 +108,14 @@ function setupInterceptors(instance: typeof http) {
|
||||
|
||||
return instance(config);
|
||||
} catch {
|
||||
await useUserStoreHook().redirectToLogin("expired");
|
||||
await useUserStoreHook().redirectToLogin();
|
||||
return Promise.reject(new Error("Token Invalid"));
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh token 失效
|
||||
if (code === ApiCodeEnum.REFRESH_TOKEN_INVALID) {
|
||||
await useUserStoreHook().redirectToLogin("expired");
|
||||
await useUserStoreHook().redirectToLogin();
|
||||
return Promise.reject(new Error("Token Invalid"));
|
||||
}
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ function createSseConnection(options: UseSseOptions = {}) {
|
||||
} catch (err) {
|
||||
logError("SSE 令牌刷新失败:", err);
|
||||
// 续期失败即会话失效,走统一出口弹窗提示后跳登录页
|
||||
await userStore.redirectToLogin("expired");
|
||||
await userStore.redirectToLogin();
|
||||
}
|
||||
}
|
||||
isManualDisconnect = true;
|
||||
|
||||
@@ -126,4 +126,4 @@ const modalConfig: IModalConfig<DeviceForm> = {
|
||||
};
|
||||
|
||||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||
export default reactive(modalConfig);
|
||||
export default reactive(modalConfig) as IModalConfig<DeviceForm>;
|
||||
|
||||
@@ -60,4 +60,4 @@ const modalConfig: IModalConfig<DeviceForm> = {
|
||||
],
|
||||
};
|
||||
|
||||
export default reactive(modalConfig);
|
||||
export default reactive(modalConfig) as IModalConfig<DeviceForm>;
|
||||
|
||||
Reference in New Issue
Block a user