mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Missing trigger AppCreateListeners on route creation (if app not exists) (#358)
* trigger-app-listener-on-route-create * remove fmt
This commit is contained in:
@@ -63,12 +63,27 @@ func (s *Server) handleRouteCreate(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
app, err = Api.Datastore.InsertApp(ctx, newapp)
|
||||
err = Api.FireBeforeAppCreate(ctx, newapp)
|
||||
if err != nil {
|
||||
log.WithError(err).Errorln(models.ErrAppsCreate)
|
||||
c.JSON(http.StatusInternalServerError, simpleError(err))
|
||||
return
|
||||
}
|
||||
|
||||
_, err = Api.Datastore.InsertApp(ctx, newapp)
|
||||
if err != nil {
|
||||
log.WithError(err).Error(models.ErrAppsCreate)
|
||||
c.JSON(http.StatusInternalServerError, simpleError(models.ErrAppsCreate))
|
||||
return
|
||||
}
|
||||
|
||||
err = Api.FireAfterAppCreate(ctx, newapp)
|
||||
if err != nil {
|
||||
log.WithError(err).Errorln(models.ErrAppsCreate)
|
||||
c.JSON(http.StatusInternalServerError, simpleError(err))
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_, err = Api.Datastore.InsertRoute(ctx, wroute.Route)
|
||||
|
||||
Reference in New Issue
Block a user