"use strict";

/*
 * *******************************************************************************
 *  * Copyright (c) 2018 Edgeworx, Inc.
 *  *
 *  * This program and the accompanying materials are made available under the
 *  * terms of the Eclipse Public License v. 2.0 which is available at
 *  * http://www.eclipse.org/legal/epl-2.0
 *  *
 *  * SPDX-License-Identifier: EPL-2.0
 *  *******************************************************************************
 *
 */

$(document).ready(function () {
    var accTok = apwGetAccessToken();
    getUserDetails(accTok).then(function (result) {
        AppWorks_Start();
        Activate_Handlers_For_User_Update_Profile();
    });
});

var getUserDetails = function getUserDetails(accTok) {
    return $.ajax({
        url: fogControllerUrl + ioAuthoring.urls.getUserDetails + accTok,
        dataType: "json",
        success: function success(res) {
            if (res.status == 'ok') {
                $("#userData").html(ejs.render(ioAuthoring.templates.getUserDetails, { "user": res.user }, {}));
            }
        }
    });
};