mirror of
https://github.com/yldio/copilot.git
synced 2024-12-29 05:10:05 +02:00
fix(cp-frontend): handle error validating name
This commit is contained in:
parent
2b552360e0
commit
0cf61c628a
@ -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!` };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user