audiobookshelf/client/mixins/apiRequestHelpers.js
2023-11-28 12:11:14 -08:00

13 lines
327 B
JavaScript

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)
}
}
}