Added error handling; Made querystring helper

This commit is contained in:
Kieran Eglin 2023-11-28 12:11:14 -08:00
parent e5579b2c33
commit d9c9289d65
No known key found for this signature in database
GPG key ID: 193984967FCF432D
3 changed files with 34 additions and 8 deletions

View file

@ -0,0 +1,12 @@
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)
}
}
}