client update error catch

This commit is contained in:
Barry Low committed 2018-09-03 16:45:16 -07:00
1 parent 7884e96ec0
commit 7cbbf59885
3 files changed
+33 -17

No files matched your search

+1 -1
View File
@@ -68,7 +68,7 @@ const link = split(
const authLink = onError(({ graphQLErrors, networkError, operation, forward }) => {
if (graphQLErrors) {
// User access token has expired
console.log('authLink: ', graphQLErrors)
// console.log('authLink: ', graphQLErrors) // check for error message to intercept and resend with Auth0 access token
if (graphQLErrors[0].message === 'Not logged in') {
// We assume we have auth0 access token needed to run the async request
// Let's refresh token through async request
@@ -39,7 +39,13 @@ export const team = {
query: UniqueTeamnameQuery,
variables: { name: value }
})
return actions.createTeam.unique(result.data.teamByName.name === null)
.catch((res) => {
const errors = res.graphQLErrors.map((error) => {
return error.message
})
return actions.form({ form: 'uniqueTeamnameError', message: errors })
})
return actions.createTeam.unique(result.data.teamByName === null)
},
createTeam: {
input: value => state => {
@@ -190,6 +196,12 @@ export const team = {
}
}
})
.catch((res) => {
const errors = res.graphQLErrors.map((error) => {
return error.message
})
return actions.form({ form: 'deleteTeamError', message: errors })
})
if (result.data.deleteTeam.id !== null) {
return actions.deleteTeamSuccess({ name: '' })
@@ -3,20 +3,24 @@ import { h } from 'hyperapp'
import { TeamList } from '../../../../modules/team/views'
export const Overview = () => (state, actions) => (
<section
class='section has-text-centered p-l-5 p-r-5'
key='TeamOverviewContainer'
oncreate={() => actions.team.getTeam(state.user.id)}
>
<div class='box p-t-3 p-b-5 p-l-5 p-r-5 m-b-5'>
<h1 class='title has-text-centered is-uppercase is-condensed is-size-3'>
Team Overview
</h1>
<hr />
<TeamList />
</div>
</section>
)
export const Overview = () => (state, actions) => {
if (state.team.form.form === 'addTeamSuccess') actions.updateTeamView()
return (
<section
class='section has-text-centered p-l-5 p-r-5'
key='TeamOverviewContainer'
oncreate={() => actions.team.getTeam(state.user.id)}
>
<div class='box p-t-3 p-b-5 p-l-5 p-r-5 m-b-5'>
<h1 class='title has-text-centered is-uppercase is-condensed is-size-3'>
Team Overview
</h1>
<hr />
<TeamList />
</div>
</section>
)
}
export default Overview