Add error to GetDefaultApplication()

This commit is contained in:
Gucheng Wang
2022-10-09 10:39:33 +08:00
parent a955fb57d6
commit 44ad88353f
2 changed files with 10 additions and 9 deletions

View File

@ -133,11 +133,12 @@ func (c *ApiController) GetDefaultApplication() {
userId := c.GetSessionUsername()
id := c.Input().Get("id")
application := object.GetMaskedApplication(object.GetDefaultApplication(id), userId)
if application == nil {
c.ResponseError("Please set a default application for this organization")
application, err := object.GetDefaultApplication(id)
if err != nil {
c.ResponseError(err.Error())
return
}
c.ResponseOk(application)
maskedApplication := object.GetMaskedApplication(application, userId)
c.ResponseOk(maskedApplication)
}