aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/misc/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/misc/utils.ts')
-rw-r--r--client/src/app/shared/misc/utils.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts
index b9aa223cf..79c93c1b3 100644
--- a/client/src/app/shared/misc/utils.ts
+++ b/client/src/app/shared/misc/utils.ts
@@ -55,6 +55,15 @@ function immutableAssign <A, B> (target: A, source: B) {
55 return Object.assign({}, target, source) 55 return Object.assign({}, target, source)
56} 56}
57 57
58function objectToUrlEncoded (obj: any) {
59 const str: string[] = []
60 for (const key of Object.keys(obj)) {
61 str.push(encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]))
62 }
63
64 return str.join('&')
65}
66
58// Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34 67// Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34
59function objectToFormData (obj: any, form?: FormData, namespace?: string) { 68function objectToFormData (obj: any, form?: FormData, namespace?: string) {
60 let fd = form || new FormData() 69 let fd = form || new FormData()
@@ -100,6 +109,7 @@ function isInMobileView () {
100} 109}
101 110
102export { 111export {
112 objectToUrlEncoded,
103 getParameterByName, 113 getParameterByName,
104 populateAsyncUserVideoChannels, 114 populateAsyncUserVideoChannels,
105 getAbsoluteAPIUrl, 115 getAbsoluteAPIUrl,