Handle changes to createLabel response. Trim label names

This commit is contained in:
Jackson Harper
2022-04-12 21:49:48 -07:00
parent 5a77bd8332
commit 5a4e4baae6

View File

@ -183,18 +183,14 @@ export default function LabelsPage(): JSX.Element {
async function createLabel(): Promise<void> {
const res = await createLabelMutation(
nameInputText,
nameInputText.trim(),
labelColorHex.value,
descriptionInputText
)
if (res) {
if (res.createLabel.errorCodes && res.createLabel.errorCodes.length > 0) {
showErrorToast(res.createLabel.errorCodes[0])
} else {
showSuccessToast('Label created', { position: 'bottom-right' })
resetLabelState()
revalidate()
}
showSuccessToast('Label created', { position: 'bottom-right' })
resetLabelState()
revalidate()
} else {
showErrorToast('Failed to create label')
}