audiobookshelf/client/mixins/apiRequestHelpers.js

13 lines
327 B
JavaScript
Raw Normal View History

export default {
methods: {
buildQuerystring(obj, opts = { includePrefix: false }) {
let querystring = Object
.entries(obj)
.map(([key, val]) => `${encodeURIComponent(key)}=${encodeURIComponent(val)}`)
.join('&')
return (opts.includePrefix ? '?' : '').concat(querystring)
}
}
}