Store service tester
See tester for Select, or Update service.
Below is the code used in the demo.
function done(result, error) {
client.closePopupWindow();
if (result) {
alert('receive result: ' + JSON.stringify(result));
} else {
alert('receive error: ' + JSON.stringify(error));
}
}
var client = window.accountchooser.CdsClient.init({
popupMode: false,
popupWidth: 640,
popupHeight: 480,
clientCallbackUrl: window.location.protocol + '//gitkit-tool.appspot.com/store.htm',
callbacks: {
store: done
}});
var store = function() {
client.changePopupModeTo(jQuery('#popupMode').prop('checked'));
var accounts = [{
email: jQuery('#email').val(),
displayName: jQuery('#displayName').val(),
photoUrl: jQuery('#photoUrl').val(),
providerId: jQuery('#providerId').val()
}];
if (jQuery('#multipleAccounts').prop('checked')) {
accounts.push({
email: jQuery('#email1').val(),
displayName: jQuery('#displayName1').val(),
photoUrl: jQuery('#photoUrl1').val(),
providerId: jQuery('#providerId1').val()
});
}
var cdsOptions = {language: jQuery('#language').val()};
client.store(accounts, cdsOptions);
};