1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-02-09 12:14:03 +02:00

sort the auth providers by their Name field

This commit is contained in:
Gani Georgiev 2023-11-27 20:05:06 +02:00
parent 05cc3f9e6c
commit 3b79535dc7

View File

@ -6,6 +6,7 @@ import (
"fmt"
"log/slog"
"net/http"
"sort"
"github.com/labstack/echo/v5"
"github.com/pocketbase/dbx"
@ -156,6 +157,11 @@ func (api *recordAuthApi) authMethods(c echo.Context) error {
})
}
// sort providers
sort.SliceStable(result.AuthProviders, func(i, j int) bool {
return result.AuthProviders[i].Name < result.AuthProviders[j].Name
})
return c.JSON(http.StatusOK, result)
}