From dc58b15913db6e0283584be2c811eb732f129236 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Thu, 19 Aug 2021 01:27:03 +0000
Subject: [PATCH] fix bug, cant save config
---
platform/Vercel.php | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/platform/Vercel.php b/platform/Vercel.php
index 480073d..5f440af 100644
--- a/platform/Vercel.php
+++ b/platform/Vercel.php
@@ -314,8 +314,8 @@ function setVercelConfig($envs, $appId, $token)
foreach ($result["envs"] as $key => $value) {
$existEnvs[$value["key"]] = $value["id"];
}
- $response = null;
foreach ($envs as $key => $value) {
+ $response = null;
$tmp = null;
$tmp["type"] = "encrypted";
$tmp["key"] = $key;
@@ -327,8 +327,8 @@ function setVercelConfig($envs, $appId, $token)
} else {
if ($value) $response = curl("POST", $url, json_encode($tmp), $header);
}
- //echo $key . " = " . $value . ",
" . json_encode($response, JSON_PRETTY_PRINT) . "
";
- if ($response['stat']!=200) return $response['body'];
+ //echo $key . " = " . $value . ",
" . $response . json_encode($response, JSON_PRETTY_PRINT) . "
";
+ if (!!$response && $response['stat']!=200) return $response['body'];
}
return VercelUpdate($appId, $token);
}
@@ -351,6 +351,7 @@ function VercelUpdate($appId, $token, $sourcePath = "")
//echo json_encode($data, JSON_PRETTY_PRINT) . " ,data
";
$response = curl("POST", $url, json_encode($data), $header);
+ //echo json_encode($response, JSON_PRETTY_PRINT) . " ,res
";
$result = json_decode($response["body"], true);
$result['status'] = $result['id'];
return json_encode($result);