Nhảy tới nội dung

openProfile

Bắt đầu hỗ trợ ở phiên bản:

  • API: 2.5.3
Lưu ý

Cần xin cấp quyền tại trang Quản lý ứng dụng

Cho phép ứng dụng mở profile của User hoặc Official Account.

Parameters

Object object

PropertyTypeDefaultRequiredDescriptionMinimum Version
typestringtrueNhận các giá trị sau:
  • 'user': Mở profile User
  • 'oa': Mở profile OA
  • 'aliasOA': Mở profile OA bằng Alias (field id truyền lên là alias của OA).
idstringtrueId của User hoặc OA
successfunctionCallback function khi gọi api thành công
failfunctionCallback function khi gọi api thất bại

Sample Code

import api from 'zmp-sdk';

api.login({
success: () => {
api.openProfile({
type: 'oa',
id: 'oa-id',
success: () => {},
fail: (err) => {}
});
},
fail: (err) => {}
});

// hoặc
const test = async () => {
try {
await api.login();
await api.openProfile({
type: 'oa',
id: 'oa-id'
});
} catch (error) {
// xử lý khi gọi api thất bại
console.log(error);
}
};