mirror of
https://github.com/glenndehaan/unifi-voucher-site.git
synced 2026-04-05 08:54:17 -04:00
Type cast according to UniFi hotspot documentation
This commit is contained in:
@@ -22,9 +22,9 @@ module.exports = {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// Set base voucher data
|
// Set base voucher data
|
||||||
const data = {
|
const data = {
|
||||||
count: amount,
|
count: typeof amount === "string" ? parseInt(amount): amount,
|
||||||
name: note,
|
name: note,
|
||||||
timeLimitMinutes: type.expiration
|
timeLimitMinutes: parseInt(type.expiration)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set voucher limit usage if limited
|
// Set voucher limit usage if limited
|
||||||
@@ -34,17 +34,17 @@ module.exports = {
|
|||||||
|
|
||||||
// Set data usage limit if limited
|
// Set data usage limit if limited
|
||||||
if(typeof type.megabytes !== "undefined") {
|
if(typeof type.megabytes !== "undefined") {
|
||||||
data.dataUsageLimitMBytes = type.megabytes;
|
data.dataUsageLimitMBytes = parseInt(type.megabytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set download speed limit if limited
|
// Set download speed limit if limited
|
||||||
if(typeof type.download !== "undefined") {
|
if(typeof type.download !== "undefined") {
|
||||||
data.rxRateLimitKbps = type.download;
|
data.rxRateLimitKbps = parseInt(type.download);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set upload speed limit if limited
|
// Set upload speed limit if limited
|
||||||
if(typeof type.upload !== "undefined") {
|
if(typeof type.upload !== "undefined") {
|
||||||
data.txRateLimitKbps = type.upload;
|
data.txRateLimitKbps = parseInt(type.upload);
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(`/hotspot/vouchers`, 'POST', {}, data).then((response) => {
|
fetch(`/hotspot/vouchers`, 'POST', {}, data).then((response) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user