From 21175bda62722f06be1ef2aa64dfafa6cfa2f4bd Mon Sep 17 00:00:00 2001 From: dhax Date: Thu, 16 Apr 2020 13:58:21 +0200 Subject: [PATCH] use pointer to account list --- api/admin/accounts.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/admin/accounts.go b/api/admin/accounts.go index 630bd33..46f69dc 100644 --- a/api/admin/accounts.go +++ b/api/admin/accounts.go @@ -88,11 +88,11 @@ func newAccountResponse(a *pwdless.Account) *accountResponse { } type accountListResponse struct { - Accounts []pwdless.Account `json:"accounts"` - Count int `json:"count"` + Accounts *[]pwdless.Account `json:"accounts"` + Count int `json:"count"` } -func newAccountListResponse(a []pwdless.Account, count int) *accountListResponse { +func newAccountListResponse(a *[]pwdless.Account, count int) *accountListResponse { resp := &accountListResponse{ Accounts: a, Count: count, @@ -111,7 +111,7 @@ func (rs *AccountResource) list(w http.ResponseWriter, r *http.Request) { render.Render(w, r, ErrRender(err)) return } - render.Respond(w, r, newAccountListResponse(al, count)) + render.Respond(w, r, newAccountListResponse(&al, count)) } func (rs *AccountResource) create(w http.ResponseWriter, r *http.Request) {