wso2 carbon how to fix Cannot read property 'getTenantDomain' of undefined at getGadgetLocation?

187 Views Asked by At

I'm currently working in wso2 carbon. I have developed one gadget and successfully integrated as well but gadget-util.js file showing an error of

   Uncaught TypeError: Cannot read property 'getTenantDomain' of undefined
        at getGadgetLocation

my code is gadget-util.js

var getGadgetLocation = function (callback) {
    var gadgetLocation = "/portal/store/carbon.super/fs/gadget/circle_d3";
    var PATH_SEPERATOR = "/";


    if (gadgetLocation.search("store") != -1) 

{

        wso2.gadgets.identity.getTenantDomain(function (tenantDomain) {


            var gadgetPath = gadgetLocation.split(PATH_SEPERATOR);
            var modifiedPath = '';
            for (var i = 1; i < gadgetPath.length; i++) {
                if (i === 3) {
                    modifiedPath = modifiedPath.concat(PATH_SEPERATOR, tenantDomain);
                } else {
                    modifiedPath = modifiedPath.concat(PATH_SEPERATOR, gadgetPath[i])
                }
            }
            callback(modifiedPath);
        });
    } else {
        callback(gadgetLocation)
    }
    callback(gadgetLocation);
}

please help me

1

There are 1 best solutions below

0
On BEST ANSWER