feat(custom-request): add support for API token variable (#5263)

* feat(custom-request): add support for API token variable

* perf: improve user experience
This commit is contained in:
Zeke Zhang 2024-09-12 17:59:51 +08:00 committed by GitHub
parent 3f62c90b3e
commit 152651931f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 1 deletions

View File

@ -70,7 +70,7 @@ export function CustomRequestSettingsItem() {
},
});
refresh();
return message.success(t('Saved successfully'));
message.success(t('Saved successfully'));
}}
/>
</>

View File

@ -43,6 +43,11 @@ export const useCustomRequestVariableOptions = () => {
title: t('Current time', { ns: 'client' }),
children: null,
},
{
name: '$nToken',
title: 'API token',
children: null,
},
];
}, [fields, userFields]);
};

View File

@ -143,6 +143,7 @@ export async function send(this: CustomRequestPlugin, ctx: Context, next: Next)
},
currentUser,
currentTime: new Date().toISOString(),
$nToken: ctx.getBearerToken(),
};
const getParsedValue = (value) => {