feat: authentication providers resolver - filter + orderBy

This commit is contained in:
NGPixel
2018-03-09 00:33:43 -05:00
parent 6ff4152e1c
commit 69a0711d16
7 changed files with 151 additions and 96 deletions

View File

@@ -30,6 +30,8 @@
<script>
/* global CONSTANTS, graphQL, siteConfig */
import _ from 'lodash'
export default {
data () {
return {
@@ -68,13 +70,10 @@ export default {
refreshStrategies () {
this.isLoading = true
graphQL.query({
query: CONSTANTS.GRAPHQL.GQL_QUERY_AUTHENTICATION,
variables: {
mode: 'active'
}
query: CONSTANTS.GRAPH.AUTHENTICATION.QUERY_LOGIN_PROVIDERS
}).then(resp => {
if (resp.data.authentication) {
this.strategies = resp.data.authentication
if (_.has(resp, 'data.authentication.providers')) {
this.strategies = _.get(resp, 'data.authentication.providers', [])
} else {
throw new Error('No authentication providers available!')
}

View File

@@ -11,7 +11,6 @@ export default {
props
title
useForm
icon
config {
key
value
@@ -19,6 +18,21 @@ export default {
}
}
}
`,
QUERY_LOGIN_PROVIDERS: gql`
query {
authentication {
providers(
filter: "isEnabled eq true",
orderBy: "title ASC"
) {
key
title
useForm
icon
}
}
}
`
},
GQL_QUERY_TRANSLATIONS: gql`