mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Handle changes to createLabel response. Trim label names
This commit is contained in:
parent
5a77bd8332
commit
5a4e4baae6
1 changed files with 4 additions and 8 deletions
|
|
@ -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')
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue