qa: If admin link is down, use local data instead
This commit is contained in:
parent
9a5347b8ef
commit
c31f76e9c3
2 changed files with 10 additions and 48 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"net/http"
|
||||
"strconv"
|
||||
|
||||
adminapi "srs.epita.fr/fic-server/admin/api"
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
@ -68,5 +69,13 @@ func showExercice(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
fwdAdminRequest(c, fmt.Sprintf("/api/exercices/%s", string(c.Param("eid"))))
|
||||
var e adminapi.Exercice
|
||||
err := fwdAdmin(c.Request.Method, fmt.Sprintf("/api/exercices/%s", string(c.Param("eid"))), nil, &e)
|
||||
if err != nil {
|
||||
log.Println("Unable to make request to admin:", err.Error())
|
||||
c.JSON(http.StatusOK, c.MustGet("exercice"))
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, e)
|
||||
}
|
||||
|
|
Reference in a new issue