🐛 fix(api): Fix type error in API request and add return URL parameter

This commit is contained in:
web@ppanel
2025-02-21 12:59:23 +07:00
parent 4418c47f4f
commit ee286dd629
23 changed files with 71 additions and 72 deletions
@@ -23,12 +23,12 @@ export default function Page() {
},
});
async function updateConfig(key: keyof API.UpdataAuthMethodConfigRequest, value: unknown) {
async function updateConfig(key: keyof API.UpdateAuthMethodConfigRequest, value: unknown) {
try {
await updateAuthMethodConfig({
...data,
[key]: value,
} as API.UpdataAuthMethodConfigRequest);
} as API.UpdateAuthMethodConfigRequest);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
@@ -21,12 +21,12 @@ export default function Page() {
},
});
async function updateConfig(key: keyof API.UpdataAuthMethodConfigRequest, value: unknown) {
async function updateConfig(key: keyof API.UpdateAuthMethodConfigRequest, value: unknown) {
try {
await updateAuthMethodConfig({
...data,
[key]: value,
} as API.UpdataAuthMethodConfigRequest);
} as API.UpdateAuthMethodConfigRequest);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
@@ -48,7 +48,7 @@ export default function Page() {
await updateAuthMethodConfig({
...ref.current,
[key]: value,
} as API.UpdataAuthMethodConfigRequest);
} as API.UpdateAuthMethodConfigRequest);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
@@ -22,12 +22,12 @@ export default function Page() {
},
});
async function updateConfig(key: keyof API.UpdataAuthMethodConfigRequest, value: unknown) {
async function updateConfig(key: keyof API.UpdateAuthMethodConfigRequest, value: unknown) {
try {
await updateAuthMethodConfig({
...data,
[key]: value,
} as API.UpdataAuthMethodConfigRequest);
} as API.UpdateAuthMethodConfigRequest);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
@@ -22,12 +22,12 @@ export default function Page() {
},
});
async function updateConfig(key: keyof API.UpdataAuthMethodConfigRequest, value: unknown) {
async function updateConfig(key: keyof API.UpdateAuthMethodConfigRequest, value: unknown) {
try {
await updateAuthMethodConfig({
...data,
[key]: value,
} as API.UpdataAuthMethodConfigRequest);
} as API.UpdateAuthMethodConfigRequest);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
@@ -22,12 +22,12 @@ export default function Page() {
},
});
async function updateConfig(key: keyof API.UpdataAuthMethodConfigRequest, value: unknown) {
async function updateConfig(key: keyof API.UpdateAuthMethodConfigRequest, value: unknown) {
try {
await updateAuthMethodConfig({
...data,
[key]: value,
} as API.UpdataAuthMethodConfigRequest);
} as API.UpdateAuthMethodConfigRequest);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
@@ -61,7 +61,7 @@ export default function Page() {
await updateAuthMethodConfig({
...data,
[key]: value,
} as API.UpdataAuthMethodConfigRequest);
} as API.UpdateAuthMethodConfigRequest);
toast.success(t('updateSuccess'));
refetch();
} catch (error) {
@@ -22,12 +22,12 @@ export default function Page() {
},
});
async function updateConfig(key: keyof API.UpdataAuthMethodConfigRequest, value: unknown) {
async function updateConfig(key: keyof API.UpdateAuthMethodConfigRequest, value: unknown) {
try {
await updateAuthMethodConfig({
...data,
[key]: value,
} as API.UpdataAuthMethodConfigRequest);
} as API.UpdateAuthMethodConfigRequest);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
@@ -143,7 +143,7 @@ export function SubscriptionDetail({
header: 'ID',
},
{
accessorKey: 'imei',
accessorKey: 'identifier',
header: 'IMEI',
},
{
@@ -182,7 +182,7 @@ export function SubscriptionDetail({
}}
actions={{
render: (row) => {
if (!row.imei) return [];
if (!row.identifier) return [];
return [
<ConfirmButton
key='offline'
+1 -1
View File
@@ -19,7 +19,7 @@ export async function getAuthMethodConfig(
/** Update auth method config PUT /v1/admin/auth-method/config */
export async function updateAuthMethodConfig(
body: API.UpdataAuthMethodConfigRequest,
body: API.UpdateAuthMethodConfigRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.AuthMethodConfig }>('/v1/admin/auth-method/config', {
+1 -1
View File
@@ -1,5 +1,5 @@
// @ts-ignore
// API 更新时间:
// API 唯一标识:
import * as announcement from './announcement';
+8 -8
View File
@@ -1177,13 +1177,6 @@ declare namespace API {
security_config: SecurityConfig;
};
type UpdataAuthMethodConfigRequest = {
id: number;
method: string;
config: Record<string, any>;
enabled: boolean;
};
type UpdateAlipayF2fRequest = {
id: number;
name: string;
@@ -1230,6 +1223,13 @@ declare namespace API {
application_id: number;
};
type UpdateAuthMethodConfigRequest = {
id: number;
method: string;
config: Record<string, any>;
enabled: boolean;
};
type UpdateCouponRequest = {
id: number;
name: string;
@@ -1440,7 +1440,7 @@ declare namespace API {
type UserDevice = {
id: number;
ip: string;
imei: string;
identifier: string;
user_agent: string;
online: boolean;
enabled: boolean;
+1 -1
View File
@@ -1,5 +1,5 @@
// @ts-ignore
// API 更新时间:
// API 唯一标识:
import * as auth from './auth';
+1 -1
View File
@@ -628,7 +628,7 @@ declare namespace API {
type UserDevice = {
id: number;
ip: string;
imei: string;
identifier: string;
user_agent: string;
online: boolean;
enabled: boolean;