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.
16 lines
326 B
16 lines
326 B
|
3 years ago
|
import isObject from '../../utils/isObject';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @description: 包装一个成功返回对象
|
||
|
|
* @param {*} data
|
||
|
|
* @return {{
|
||
|
|
* ok: true
|
||
|
|
* code: number|string
|
||
|
|
* data: any
|
||
|
|
* }}
|
||
|
|
*/
|
||
|
|
export default function createSuccess(data) {
|
||
|
|
data = isObject(data) ? data : { data };
|
||
|
|
return { ok: true, code: 200, ...data };
|
||
|
|
}
|