Fix teams screen throwing error and not loading


Former-commit-id: cfd3266412adf3acb59b8cd4fd96725b8d95d218
function viewTeams() {

    getTeams(
        success = function (data) {
            populateTeamsTable(data.teams);
        },
        error = function (jqxhr) {
            handleApiError(jqxhr);
        }
    );

    function populateTeamsTable(data) {
        var teamsHtml = templates.teamList(data);
        $('.section').html(teamsHtml);

        $('.js-selectable-table tbody tr').click(function () {
            var teamId = $(this).attr('data-id');
            viewTeamDetails(teamId, $(this));
        });

        $('.form-create-team').submit(function (e) {
            e.preventDefault();

            var teamName = $('#create-team-name').val();

            if (teamName.length < 1) {
                sweetAlert("Please enter a user name.");
                return;
            }

            teamName = teamName.trim();
            postTeam(teamName);
        });
    }
}



function viewTeams() {

    getTeams(
        success = function (data) {
            populateTeamsTable(data.teams);
        },
        error = function (jqxhr) {
            handleApiError(jqxhr);
        }
    );

    function populateTeamsTable(data) {
        var teamsHtml = templates.teamList(teams);
        $('.section').html(teamsHtml);

        $('.js-selectable-table tbody tr').click(function () {
            var teamId = $(this).attr('data-id');
            viewTeamDetails(teamId, $(this));
        });

        $('.form-create-team').submit(function (e) {
            e.preventDefault();

            var teamName = $('#create-team-name').val();

            if (teamName.length < 1) {
                sweetAlert("Please enter a user name.");
                return;
            }

            teamName = teamName.trim();
            postTeam(teamName);
        });
    }
}


