13 lines
463 B
JavaScript
13 lines
463 B
JavaScript
import { OakUserException } from "oak-domain/lib/types/Exception";
|
|
export const oakHandler = (data) => {
|
|
if (data.error) {
|
|
throw new OakUserException(`获取用户信息失败: ${data.error || '未知错误'}`);
|
|
}
|
|
const { userInfo } = data;
|
|
if (!userInfo || !userInfo.id) {
|
|
throw new OakUserException("获取用户信息失败: 返回数据不包含 userInfo 或 userInfo.id");
|
|
}
|
|
const user = userInfo;
|
|
return user;
|
|
};
|