刘光辉
4 小时以前 cf11e63b659afcc9792ab3e395f1b45d844431a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import type { TrainArchiveDetail } from '#/views/x/tms/trainArchive/types';
 
import { defHttp } from '#/api/request';
 
/** 正式路径:/api/tms/train-archive/** */
const prefix = '/api/tms/train-archive';
 
async function unwrapData<T>(promise: Promise<any>): Promise<T> {
  const res = await promise;
  if (res && typeof res === 'object' && 'data' in res && ('code' in res || 'msg' in res)) {
    return res.data as T;
  }
  return res as T;
}
 
/** 当前登录用户的个人培训档案 */
export function getMyTrainArchive() {
  return unwrapData<TrainArchiveDetail>(defHttp.get({ url: `${prefix}/mine` }));
}