1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-11-29 08:56:58 +02:00

added oauth2 db errors handling and replaced the auth response map with a struct

This commit is contained in:
Gani Georgiev
2024-11-18 21:16:20 +02:00
parent 37538f2a6d
commit 52e85a8036
2 changed files with 18 additions and 6 deletions

View File

@@ -109,13 +109,17 @@ func recordAuthResponse(e *core.RequestEvent, authRecord *core.Record, token str
}
}
result := map[string]any{
"token": e.Token,
"record": e.Record,
result := struct {
Meta any `json:"meta,omitempty"`
Record *core.Record `json:"record"`
Token string `json:"token"`
}{
Token: e.Token,
Record: e.Record,
}
if e.Meta != nil {
result["meta"] = e.Meta
result.Meta = e.Meta
}
return e.JSON(http.StatusOK, result)