react-native-gigya-sdk
Version:
SAP CDC/Gigya SDK for your React Native applications
36 lines (33 loc) • 1.13 kB
JavaScript
import getState from './getState';
import setSession from './setSession';
import sendApiCall from './sendApiCall';
import getAccountInfo from './getAccountInfo';
export default function (options) {
return new Promise(async (resolve, reject) => {
try {
var _state$regToken;
const state = await getState();
const response = await sendApiCall('accounts.finalizeRegistration', {
regToken: (_state$regToken = state.regToken) === null || _state$regToken === void 0 ? void 0 : _state$regToken.value,
targetEnv: 'mobile'
});
const {
sessionToken,
sessionSecret
} = response === null || response === void 0 ? void 0 : response.sessionInfo;
if (options !== null && options !== void 0 && options.noSetSession) {
return resolve(response);
}
await setSession(sessionToken, sessionSecret);
const account = await getAccountInfo({
noUID: true
});
resolve({ ...account,
sessionInfo: response.sessionInfo
});
} catch (e) {
reject(e);
}
});
}
//# sourceMappingURL=finalizeRegistration.js.map