1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-14 07:10:05 +02:00

fix(cp-frontend): handle error validating name

This commit is contained in:
Sérgio Ramos 2017-08-03 13:42:39 +01:00
parent 2b552360e0
commit 0cf61c628a

View File

@ -38,15 +38,15 @@ class DeploymentGroupEditOrCreate extends Component {
destroyOnUnmount: true,
forceUnregisterOnUnmount: true,
asyncValidate: async ({ name = '' }) => {
const { data } = await client.query({
const [err] = await intercept(client.query({
fetchPolicy: 'network-only',
query: DeploymentGroupBySlugQuery,
variables: {
slug: paramCase(name.trim())
}
});
}));
if (data.deploymentGroups.length) {
if (!err) {
// eslint-disable-next-line no-throw-literal
throw { name: `"${name}" already exists!` };
}