|
|
@ -108,20 +108,26 @@ async function injectStore(name) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* getting url for assets of directus api
|
|
|
|
* mediaUrl - create url for assets from directus,
|
|
|
|
|
|
|
|
* default options are with access_token for permissions
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param string string
|
|
|
|
*
|
|
|
|
* @param array array
|
|
|
|
* @param {String} id
|
|
|
|
* @return string
|
|
|
|
* @param {Object} options
|
|
|
|
|
|
|
|
* @return {String}
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function mediaUrl(id, options = null)
|
|
|
|
function mediaUrl(id, options = {})
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let query = '';
|
|
|
|
let query
|
|
|
|
|
|
|
|
|
|
|
|
if (options) {
|
|
|
|
// merge options, default is access_token
|
|
|
|
|
|
|
|
options = Object.assign({
|
|
|
|
|
|
|
|
'access_token': process.env.DIRECTUS_API_TOKEN
|
|
|
|
|
|
|
|
}, options)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create query
|
|
|
|
query = '?' + new URLSearchParams(options).toString();
|
|
|
|
query = '?' + new URLSearchParams(options).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return process.env.DIRECTUS_API_URL + '/assets/' + id + query;
|
|
|
|
return process.env.DIRECTUS_API_URL + '/assets/' + id + query;
|
|
|
|
}
|
|
|
|
}
|
|
|
|