Skip to main content
Version: v2

getProfile

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Get user information.

info

permission code: data:user.info

Type

function getProfile(): Result

Parameters

Result

PropertyTypeDescriptionAPI_LEVEL
agenumberUser age, 0 if no data2.0
heightnumberUser height, 0 if no data2.0
weightnumberUser weight, 0 if no data2.0
gendernumberUser gender, value refer to user gender constants2.0
nickNamestringUser's nickname2.0
regionstringISO code of the country or region where the user account is registered2.0

Constants

User gender constants

ConstantDescriptionAPI_LEVEL
GENDER_MALEMale2.0
GENDER_FEMALEFemale2.0
GENDER_UNSPECIFIEDUser not specified2.0

Example

import { getProfile, GENDER_MALE } from '@zos/user'

const { age, gender } = getProfile()
console.log(age)

if (gender === GENDER_MALE) {
console.log('male')
}