mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-16 10:19:03 +05:30
правильная true/false сериализация для request
This commit is contained in:
parent
e44360a20b
commit
7e7a31a672
@ -1,8 +1,22 @@
|
||||
function convertQueryValue(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (value === true) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (value === false) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function buildQuery(data) {
|
||||
return Object.keys(data)
|
||||
.map(
|
||||
(keyName) =>
|
||||
[keyName, typeof data[keyName] === 'undefined' ? '' : data[keyName]]
|
||||
[keyName, convertQueryValue(data[keyName])]
|
||||
.map(encodeURIComponent)
|
||||
.join('=')
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user