fix: config not sync when add #685

This commit is contained in:
Jacky 2024-10-31 15:07:11 +08:00
parent b21eb85a1a
commit 0e3489d174
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
4 changed files with 12 additions and 32 deletions

View file

@ -76,12 +76,20 @@ func AddConfig(c *gin.Context) {
return
}
err = q.Create(&model.Config{
cfg := &model.Config{
Name: name,
Filepath: path,
SyncNodeIds: json.SyncNodeIds,
SyncOverwrite: json.Overwrite,
})
}
err = q.Create(cfg)
if err != nil {
api.ErrHandler(c, err)
return
}
err = config.SyncToRemoteServer(cfg, json.NewFilepath)
if err != nil {
api.ErrHandler(c, err)
return