aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/misc
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/misc')
-rw-r--r--client/src/app/shared/misc/utils.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts
index 53aff1b24..8381745f5 100644
--- a/client/src/app/shared/misc/utils.ts
+++ b/client/src/app/shared/misc/utils.ts
@@ -81,7 +81,7 @@ function objectToFormData (obj: any, form?: FormData, namespace?: string) {
81 } 81 }
82 82
83 if (obj[key] !== null && typeof obj[ key ] === 'object' && !(obj[ key ] instanceof File)) { 83 if (obj[key] !== null && typeof obj[ key ] === 'object' && !(obj[ key ] instanceof File)) {
84 objectToFormData(obj[ key ], fd, key) 84 objectToFormData(obj[ key ], fd, formKey)
85 } else { 85 } else {
86 fd.append(formKey, obj[ key ]) 86 fd.append(formKey, obj[ key ])
87 } 87 }
@@ -96,6 +96,11 @@ function lineFeedToHtml (obj: object, keyToNormalize: string) {
96 }) 96 })
97} 97}
98 98
99function removeElementFromArray <T> (arr: T[], elem: T) {
100 const index = arr.indexOf(elem)
101 if (index !== -1) arr.splice(index, 1)
102}
103
99export { 104export {
100 objectToUrlEncoded, 105 objectToUrlEncoded,
101 getParameterByName, 106 getParameterByName,
@@ -104,5 +109,6 @@ export {
104 dateToHuman, 109 dateToHuman,
105 immutableAssign, 110 immutableAssign,
106 objectToFormData, 111 objectToFormData,
107 lineFeedToHtml 112 lineFeedToHtml,
113 removeElementFromArray
108} 114}