Selaa lähdekoodia

fix: Ensure correct quota warning threshold type conversion

[email protected] 10 kuukautta sitten
vanhempi
sitoutus
48926b8a5a
2 muutettua tiedostoa jossa 6 lisäystä ja 6 poistoa
  1. 5 5
      controller/user.go
  2. 1 1
      web/src/components/PersonalSetting.js

+ 5 - 5
controller/user.go

@@ -913,11 +913,11 @@ func TopUp(c *gin.Context) {
 }
 
 type UpdateUserSettingRequest struct {
-	QuotaWarningType      string `json:"notify_type"`
-	QuotaWarningThreshold int    `json:"quota_warning_threshold"`
-	WebhookUrl            string `json:"webhook_url,omitempty"`
-	WebhookSecret         string `json:"webhook_secret,omitempty"`
-	NotificationEmail     string `json:"notification_email,omitempty"`
+	QuotaWarningType      string  `json:"notify_type"`
+	QuotaWarningThreshold float64 `json:"quota_warning_threshold"`
+	WebhookUrl            string  `json:"webhook_url,omitempty"`
+	WebhookSecret         string  `json:"webhook_secret,omitempty"`
+	NotificationEmail     string  `json:"notification_email,omitempty"`
 }
 
 func UpdateUserSetting(c *gin.Context) {

+ 1 - 1
web/src/components/PersonalSetting.js

@@ -330,7 +330,7 @@ const PersonalSetting = () => {
         try {
             const res = await API.put('/api/user/setting', {
                 notify_type: notificationSettings.warningType,
-                quota_warning_threshold: notificationSettings.warningThreshold,
+                quota_warning_threshold: parseFloat(notificationSettings.warningThreshold),
                 webhook_url: notificationSettings.webhookUrl,
                 webhook_secret: notificationSettings.webhookSecret,
                 notification_email: notificationSettings.notificationEmail