Compare commits
No commits in common. "b46cc6c436666f36f9b27c19b0cb400522b004f2" and "f8ef25a3235625a35a5ccaf981804e9c2abb78b1" have entirely different histories.
b46cc6c436
...
f8ef25a323
|
@ -1156,18 +1156,18 @@ func (b *browserService) SetKeyValue(param types.SetKeyParam) (resp types.JSResp
|
||||||
if len(param.Format) <= 0 {
|
if len(param.Format) <= 0 {
|
||||||
param.Format = types.FORMAT_RAW
|
param.Format = types.FORMAT_RAW
|
||||||
}
|
}
|
||||||
var savedValue any
|
|
||||||
switch strings.ToLower(param.KeyType) {
|
switch strings.ToLower(param.KeyType) {
|
||||||
case "string":
|
case "string":
|
||||||
if str, ok := param.Value.(string); !ok {
|
if str, ok := param.Value.(string); !ok {
|
||||||
resp.Msg = "invalid string value"
|
resp.Msg = "invalid string value"
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
if savedValue, err = convutil.SaveAs(str, param.Format, param.Decode, Preferences().GetDecoder()); err != nil {
|
var saveStr string
|
||||||
|
if saveStr, err = convutil.SaveAs(str, param.Format, param.Decode, Preferences().GetDecoder()); err != nil {
|
||||||
resp.Msg = fmt.Sprintf(`save to type "%s" fail: %s`, param.Format, err.Error())
|
resp.Msg = fmt.Sprintf(`save to type "%s" fail: %s`, param.Format, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, err = client.Set(ctx, key, savedValue, 0).Result()
|
_, err = client.Set(ctx, key, saveStr, 0).Result()
|
||||||
// set expiration lonely, not "keepttl"
|
// set expiration lonely, not "keepttl"
|
||||||
if err == nil && expiration > 0 {
|
if err == nil && expiration > 0 {
|
||||||
client.Expire(ctx, key, expiration)
|
client.Expire(ctx, key, expiration)
|
||||||
|
@ -1254,7 +1254,6 @@ func (b *browserService) SetKeyValue(param types.SetKeyParam) (resp types.JSResp
|
||||||
if err == nil && expiration > 0 {
|
if err == nil && expiration > 0 {
|
||||||
client.Expire(ctx, key, expiration)
|
client.Expire(ctx, key, expiration)
|
||||||
}
|
}
|
||||||
savedValue = param.Value
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1262,9 +1261,9 @@ func (b *browserService) SetKeyValue(param types.SetKeyParam) (resp types.JSResp
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
resp.Success = true
|
resp.Success = true
|
||||||
resp.Data = map[string]any{
|
//resp.Data = map[string]any{
|
||||||
"value": savedValue,
|
// "value": param.Value,
|
||||||
}
|
//}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -253,5 +253,5 @@ func SaveAs(str, format, decode string, customDecoder []CmdConvert) (value strin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return str, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -769,11 +769,9 @@ const useBrowserStore = defineStore('browser', {
|
||||||
serverInst.updateDBKeyCount(db, newKey)
|
serverInst.updateDBKeyCount(db, newKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const { value: updatedValue } = data
|
// const tab = useTabStore()
|
||||||
if (updatedValue != null) {
|
// tab.updateValue({ server, db, key, value })
|
||||||
const tab = useTabStore()
|
|
||||||
tab.updateValue({ server, db, key, value: updatedValue })
|
|
||||||
}
|
|
||||||
// this.loadKeySummary({ server, db, key })
|
// this.loadKeySummary({ server, db, key })
|
||||||
return {
|
return {
|
||||||
success,
|
success,
|
||||||
|
|
Loading…
Reference in New Issue