fix: add default value for base url

This commit is contained in:
JustSong 2023-09-18 22:49:05 +08:00
parent 37e09d764c
commit 1d258cc898
2 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ type Channel struct {
CreatedTime int64 `json:"created_time" gorm:"bigint"`
TestTime int64 `json:"test_time" gorm:"bigint"`
ResponseTime int `json:"response_time"` // in milliseconds
BaseURL *string `json:"base_url" gorm:"column:base_url"`
BaseURL *string `json:"base_url" gorm:"column:base_url;default:''"`
Other string `json:"other"`
Balance float64 `json:"balance"` // in USD
BalanceUpdatedTime int64 `json:"balance_updated_time" gorm:"bigint"`

View File

@ -174,7 +174,7 @@ const EditChannel = () => {
return;
}
let localInputs = inputs;
if (localInputs.base_url.endsWith('/')) {
if (localInputs.base_url && localInputs.base_url.endsWith('/')) {
localInputs.base_url = localInputs.base_url.slice(0, localInputs.base_url.length - 1);
}
if (localInputs.type === 3 && localInputs.other === '') {