react-native-gigya-sdk
Version:
SAP CDC/Gigya SDK for your React Native applications
32 lines (31 loc) • 1.4 kB
JavaScript
import getState from './getState';
import sendApiCall from './sendApiCall';
import { setState } from '../internals/state';
export default function (options) {
return new Promise(async (resolve, reject) => {
try {
var _state$regToken;
const state = await getState();
const response = await sendApiCall('accounts.getAccountInfo', { ...((options === null || options === void 0 ? void 0 : options.noUID) && {
regToken: (options === null || options === void 0 ? void 0 : options.regToken) || ((_state$regToken = state.regToken) === null || _state$regToken === void 0 ? void 0 : _state$regToken.value)
}),
...(!(options !== null && options !== void 0 && options.noUID) && {
UID: (options === null || options === void 0 ? void 0 : options.UID) || state.UID
}),
...((options === null || options === void 0 ? void 0 : options.include) && {
include: options === null || options === void 0 ? void 0 : options.include
}),
...((options === null || options === void 0 ? void 0 : options.extraProfileFields) && {
extraProfileFields: options === null || options === void 0 ? void 0 : options.extraProfileFields
})
});
await setState({
UID: response.UID
});
resolve(response);
} catch (e) {
reject(e);
}
});
}
//# sourceMappingURL=getAccountInfo.js.map