You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
587 B

7 months ago
function resultSuccess<T = Record<string, any>>(result: T, { message = 'ok' } = {}) {
return {
code: 0,
result,
message,
type: 'success',
};
}
function resultError(message = 'Request failed', { code = -1, result = null } = {}) {
return {
code,
result,
message,
type: 'error',
};
}
/**
* @description request数据中获取token
*
*/
function getRequestToken({ headers }): string | undefined {
return headers?.authorization;
}
export { getRequestToken, resultError, resultSuccess };