Skip to content

Commit

Permalink
feat(miniapp): add params for getUserInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyiming0803 committed Jun 14, 2023
1 parent 804f32b commit d9173d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/miniapp/src/Authing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import {
GetAccessTokenOptions,
UpdateEmailRequestOptions,
UpdatePhoneRequestOptions,
DeleteAccountRequestOptions
DeleteAccountRequestOptions,
GerUserInfo
} from './types'

import { returnSuccess, returnError } from './helpers/return'
Expand Down Expand Up @@ -511,7 +512,11 @@ export class Authing {
return returnSuccess(updatePasswordRes)
}

async getUserInfo(): Promise<SDKResponse<UserInfo>> {
async getUserInfo(data: GerUserInfo = {
withCustomData: false,
withDepartmentIds: false,
withIdentities: false
}): Promise<SDKResponse<UserInfo>> {
const [error, loginState] = await this.getLoginState()

if (error) {
Expand All @@ -534,7 +539,8 @@ export class Authing {
header: {
'x-authing-userpool-id': this.options.userPoolId,
Authorization: access_token
}
},
data
})

if (getProfileError) {
Expand Down
6 changes: 6 additions & 0 deletions packages/miniapp/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,3 +476,9 @@ export interface ErrorData {
statusCode?: number
apiCode?: number
}

export interface GerUserInfo {
withDepartmentIds?: boolean
withCustomData?: boolean
withIdentities?: boolean
}

0 comments on commit d9173d2

Please sign in to comment.