Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/*
* The error is not handled because the `this.$router.replace()` call is
* only used to replace the current URL, no navigation is expected.
* vue-router can not navigate to the same URL again and errors as of
* version 3.1.0.
*
* See https://github.com/vuejs/vue-router/issues/2872#issuecomment-519073998
*/
this.$router.replace({
path: '/files',
query: query
}).catch(err => {}) // eslint-disable-line handle-callback-err
return {
queryString: qs.stringify(query, { addQueryPrefix: true }),
sanitizedQueryString: qs.stringify(
sanitizedQuery, { addQueryPrefix: true }
)
}
},
loadFiles: function (fetchNextPage) {
const makeRequestPath = () => {
let url: string;
if (__internal_hasExplicitBase) {
url = composeUrl(base!, "", path || "");
} else {
url = composeUrl(base!, parentPath!, requestPath || path || "");
}
// We use ! because it's in defaultProps
if (Object.keys(this.props.queryParams!).length) {
url += `?${qs.stringify(this.props.queryParams)}`;
}
return url;
};
export const toQueryString = (options = {}) =>
/**
* In the case of batched requests we want to explicitly _not_ sort the
* params because the order matters to dataloader
*/
// @ts-ignore
options.batched
? stringify(options, {
arrayFormat: "brackets",
})
: stringify(options, {
arrayFormat: "brackets",
sort: (a, b) => a.localeCompare(b),
})
export const toKey = (path, options = {}) => `${path}?${toQueryString(options)}`
/*
* The error is not handled because the `this.$router.replace()` call is
* only used to replace the current URL, no navigation is expected.
* vue-router can not navigate to the same URL again and errors as of
* version 3.1.0.
*
* See https://github.com/vuejs/vue-router/issues/2872#issuecomment-519073998
*/
this.$router.replace({
path: '/tags',
query: query
}).catch(err => {}) // eslint-disable-line handle-callback-err
return {
queryString: qs.stringify(query, { addQueryPrefix: true }),
sanitizedQueryString: qs.stringify(
sanitizedQuery, { addQueryPrefix: true }
)
}
},
loadTags: function (fetchNextPage) {
function pushByUrl(url, query) {
navigator.push({
url: query ? `url?${qs.stringify(query)}` : url,
animated: 'true'
}, event => {
console.log('callback: ', event)
})
}
return new Promise((resolve, reject) => {
const params = {}
if (account) {
params.account = account
}
if (property) {
params.property = property
}
axios.get('/api/googleaprofiles?' + qs.stringify(params)).then((response) => {
commit('SET_GOOGLE_ACCOUNTS', response.data.data)
resolve()
}, reject)
})
},
export const programsChangeFilter = (filter: TFilter) => (
dispatch: any,
getState: any
) => {
const { router } = getState();
const queryParams = qs.parse(router.location.search.slice(1));
if (filter.value === undefined) {
delete queryParams[filter.name];
} else {
queryParams[filter.name] = filter.value;
}
if (queryParams.page) {
delete queryParams.page;
}
const newUrl = router.location.pathname + "?" + qs.stringify(queryParams);
dispatch(push(newUrl));
};
export default function request (url, options) {
if (options.cross) {
const params = {
q: `select * from json where url='${url}?${stringify(options.data)}'`,
format: 'json',
}
url = `http://query.yahooapis.com/v1/public/yql?${stringify(params)}`
options = 'get'
}
return fetch(url, options)
.then(checkStatus)
.then(handelData)
.catch(handleError)
}
getQuery (query) {
if (Object.keys(query).length !== 0) {
const queryString = qs.stringify(query);
return `?${queryString}`;
}
return '';
}
_paramsToQuery ({ path, params }) {
const snakeCaseParams = deepSnakeCaseKeys(params)
const query = qs.stringify(snakeCaseParams, { encode: false })
const pathWithQuery = query ? `${path}?${query}` : path
return { path: pathWithQuery, params: {} }
}
}