Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var nextUrl = setUrlParams(
nextProps.currentUrl,
{list: {page: nextPage}},
{
___sparse: JSON.stringify(
l.set({}, nextProps.getJsonPath(), {})
)
}
)
// We compare the request id when sending started
// with the request id when the answer arrives and
// only process the answer when its still the same id.
var localRequestId = requestId
return xhr.get(
{
url: nextUrl,
json: true
},
(err, res, body) => {
if(requestId != localRequestId) {
return
}
trigger(merged, {
action: 'page-loaded',
resources: l.get(body, nextProps.getJsonPath())
})
}
)
job.state = 'loading'
var currentQuery = parseQuery(
parseUrl(window.location.toString()).query
)
var parsedUrl = parseUrl(job.resource.list_meta_data_url, true)
delete parsedUrl.search
var url = setUrlParams(
buildUrl(parsedUrl),
currentQuery
)
xhr.get(
{
url: url,
json: true
},
(err, res, json) => {
if(err || res.statusCode > 400) {
// job.state = 'initial'
callback({
status: 'failure',
job: job
})
return
}
// job.resource.list_meta_data = json
ajaxGet(urlWithParams, callback) {
xhr.get(
{
url: urlWithParams,
json: true
},
(err, res, json) => {
callback(json)
}
)
}
function UsersGet(name, callback) {
xhr.get("user/" + encodeURIComponent(name), withAuth(), handler(callback))
}
getMediaLibrary (libraryType, callback) {
if (!this._libraryData.hasOwnProperty(libraryType)) {
this._libraryData[libraryType] = null;
}
if (this._libraryData[libraryType]) {
callback(this._libraryData[libraryType]);
} else {
xhr.get({
useXDR: true,
url: LIBRARY_URL[libraryType]
}, (err, response, body) => {
if (!err) {
const data = JSON.parse(body);
this._libraryData[libraryType] = data;
callback(this._libraryData[libraryType]);
}
});
}
}
function UsersAll(callback) {
xhr.get("users", withAuth(), handler(callback))
}
var sharedLoadMetaData = ({success, error}) => {
var currentQuery = parseQuery(
parseUrl(window.location.toString()).query
)
var parsedUrl = parseUrl(data.resource.list_meta_data_url, true)
delete parsedUrl.search
var url = setUrlParams(
buildUrl(parsedUrl),
currentQuery
)
xhr.get(
{
url: url,
json: true
},
(err, res, json) => {
if(err || res.statusCode > 400) {
error()
} else {
success(json)
}
}
)
}
function KVGet(path, callback) {
xhr.get("kv" + path, withAuth(), handler(callback))
}
function RolesGet(name, callback) {
xhr.get("role/" + encodeURIComponent(name), withAuth(), handler(callback))
}