Remove dashboard call and fetch Budgets with login

This commit is contained in:
2022-01-25 22:29:35 +00:00
parent 9e3dde8076
commit de6054359a
5 changed files with 57 additions and 24 deletions

View File

@ -93,10 +93,16 @@ func (h *Handler) loginPost(c *gin.Context) {
go h.Service.UpdateLastLogin(context.Background(), user.ID)
budgets, err := h.Service.GetBudgetsForUser(c.Request.Context(), user.ID)
if err != nil {
return
}
c.JSON(http.StatusOK, struct {
Token string
User postgres.User
}{t, user})
Token string
User postgres.User
Budgets []postgres.Budget
}{t, user, budgets})
}
type registerInformation struct {
@ -143,8 +149,14 @@ func (h *Handler) registerPost(c *gin.Context) {
go h.Service.UpdateLastLogin(context.Background(), user.ID)
budgets, err := h.Service.GetBudgetsForUser(c.Request.Context(), user.ID)
if err != nil {
return
}
c.JSON(http.StatusOK, struct {
Token string
User postgres.User
}{t, user})
Token string
User postgres.User
Budgets []postgres.Budget
}{t, user, budgets})
}