App 取得登入者資訊¶
說明如何透過 AppSettings 物件取得目前登入者的基本資料。
AppSettings.UserInfo 回傳的是 UofxUserProfileModel 物件,其定義如下:
/** 使用者基本資訊 */
interface UofxUserProfileModel {
/** 帳號 */
account: string;
/** 姓名 */
name: string;
/** 公司 Id */
corpId: string;
/** 公司名稱 */
corpName: string;
/** 公司代號 */
corpCode: string;
/** 語系 */
culture: string;
}
屬性說明¶
| 屬性名稱 | 型別 | 說明 |
|---|---|---|
| account | string | 使用者帳號 |
| name | string | 使用者姓名 |
| corpId | string | 公司 ID (GUID) |
| corpName | string | 公司名稱 |
| corpCode | string | 公司代號 |
| culture | string | 目前語系 (例如: zh-TW) |
使用範例¶
取得登入者公司 ID¶
import { AppSettings } from '@uofx/app-components';
const corpId = AppSettings.UserInfo.corpId;
console.log(corpId);