Is it possible to get user uid in login form submit in DrupalGap? I have altered the login form like

if (form_id == 'user_login_form') {
    form.submit.push('my_module_user_login_submit');
  }


In submit I need the uid.

function my_module_user_login_submit(form, form_state) {
   //I need the uid of login user here;
  if(form_state.values.name){
   form.action = 'user-dashboard/'+ uid;
   }
}


Tried

var uid = Drupal.user.uid; but not working.

More info

function my_module_menu() {
var items = {};
items['user-dashboard/%'] = {
    title: 'User dashboard',
    page_callback: 'my_module_user_dashboard_page',
    page_arguments: [1],
    pageshow: 'my_module_user_dashboard_pageshow'
  };
return items;
}


**
 * The user dashboard page callback.
 * @param uid
 * @returns {{}}
 */
function my_module_user_dashboard_page(uid) {
  var content = {};

  // Build an empty container where the user dashboard will go.
  var attributes = {
    id: my_module_user_dashboard_container_id(uid),
    class: 'user-dashboard'
  };
  content['my_widget_container'] = {
    markup: '&lt;div ' + drupalgap_attributes(attributes) + '&gt;' +
      'Loading dashboard...' +
    '&lt;/div&gt;'
  };

  return content;
}

/**
 * The user dashboard pageshow event handler.
 * @param uid
 */
function my_module_user_dashboard_pageshow(uid) {
alert(Drupal.user.uid);
  // Load the user account...
  user_load(uid, {
    success: function(account) {
    var content = {};
    content['txt'] = {
        markup: '&lt;div&gt;' + account.name + '&lt;/div&gt;&lt;div&gt;' + account.uid + '&lt;/div&gt;'
    };



      // Inject it into the container.
      var container_id = my_module_user_dashboard_container_id(uid);
      $('#' + container_id).html(drupalgap_render(content)).trigger('create');

    }
  });
}

function my_module_user_dashboard_container_id(uid) {
  return 'user-dashboard-' + uid;
}
Try using this hook in your app: http://api.drupalgap.org/7/global.html#hook_services_postprocess

/**
 * Implements hook_services_postprocess().
 */
function my_module_services_postprocess(options, result) {
  if (options.service == 'user' &amp;&amp; options.resource == 'login') {
    drupalgap_goto('user-dashboard/'+ Drupal.user.uid);
  }
}


You may also need to set the action on the form object to null so that DrupalGap core doesn't try to redirect the page to the path indicated by the form's action variable:

/**
 * Implements hook_form_alter().
 */
function my_module_form_alter(form, form_state, form_id) {
  if (form_id == 'user_login_form') {
    form.action = null;
  }
}