Add missing error message to create/update category mutation
This commit is contained in:
@@ -10,7 +10,7 @@ import type { CodegenConfig } from '@graphql-codegen/cli';
|
||||
|
||||
const config: CodegenConfig = {
|
||||
overwrite: true,
|
||||
schema: 'http://localhost:4567/api/graphql',
|
||||
schema: 'http://localhost:45670/api/graphql',
|
||||
documents: [
|
||||
'src/lib/graphql/queries/**',
|
||||
'src/lib/graphql/mutations/**',
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
},
|
||||
"error": {
|
||||
"label": {
|
||||
"create_failure": "Could not create category",
|
||||
"empty": "The category is empty",
|
||||
"request_failure": "Could not load categories"
|
||||
},
|
||||
@@ -511,6 +512,14 @@
|
||||
},
|
||||
"value": "{{value}}{{unit}}"
|
||||
},
|
||||
"history": {
|
||||
"error": {
|
||||
"label": {
|
||||
"no_history_available": "You have not read any series yet."
|
||||
}
|
||||
},
|
||||
"title": "History"
|
||||
},
|
||||
"hotkeys": {
|
||||
"create": {
|
||||
"dialog": {
|
||||
@@ -1522,13 +1531,5 @@
|
||||
}
|
||||
},
|
||||
"title": "Updates"
|
||||
},
|
||||
"history": {
|
||||
"error": {
|
||||
"label": {
|
||||
"no_history_available": "You have not read any series yet."
|
||||
}
|
||||
},
|
||||
"title": "History"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import { CategorySettingsCard } from '@/modules/category/components/CategorySett
|
||||
import { CategoryIdInfo } from '@/modules/category/Category.types.ts';
|
||||
import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
||||
import { useNavBarContext } from '@/modules/navigation-bar/contexts/NavbarContext.tsx';
|
||||
import { makeToast } from '@/modules/core/utils/Toast.ts';
|
||||
|
||||
export function CategorySettings() {
|
||||
const { t } = useTranslation();
|
||||
@@ -110,10 +111,18 @@ export function CategorySettings() {
|
||||
setDialogOpen(false);
|
||||
|
||||
if (categoryToEdit === -1) {
|
||||
requestManager.createCategory({ name: dialogName, default: dialogDefault });
|
||||
requestManager
|
||||
.createCategory({ name: dialogName, default: dialogDefault })
|
||||
.response.catch((e) =>
|
||||
makeToast(t('category.error.label.create_failure'), 'error', getErrorMessage(e)),
|
||||
);
|
||||
} else {
|
||||
const category = categories[categoryToEdit];
|
||||
requestManager.updateCategory(category.id, { name: dialogName, default: dialogDefault });
|
||||
requestManager
|
||||
.updateCategory(category.id, { name: dialogName, default: dialogDefault })
|
||||
.response.catch((e) =>
|
||||
makeToast(t('global.error.label.failed_to_save_changes'), 'error', getErrorMessage(e)),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user