This commit is contained in:
Jake Kasper
2025-08-25 13:31:08 -04:00
parent ae4f2990cf
commit fefd22f696
2 changed files with 10 additions and 1 deletions

View File

@@ -30,6 +30,10 @@ const idParamSchema = Joi.object({
id: Joi.number().integer().positive().required()
});
const userProductIdParamSchema = Joi.object({
userProductId: Joi.number().integer().positive().required()
});
// @route GET /api/product-spreader-settings/product/:productId
// @desc Get spreader settings for a specific product
// @access Private
@@ -66,7 +70,7 @@ router.get('/product/:productId', validateParams(idParamSchema), async (req, res
// @route GET /api/product-spreader-settings/user-product/:userProductId
// @desc Get spreader settings for a specific user product
// @access Private
router.get('/user-product/:userProductId', validateParams(idParamSchema), async (req, res, next) => {
router.get('/user-product/:userProductId', validateParams(userProductIdParamSchema), async (req, res, next) => {
try {
const userProductId = req.params.userProductId;

View File

@@ -836,7 +836,12 @@ const EditProductModal = ({ product, onSubmit, onCancel, sharedProducts, categor
});
if (response.ok) {
const data = await response.json();
console.log('Received spreader settings data:', data);
setEditSpreaderSettings(data.data?.settings || []);
} else {
console.error('Failed to fetch spreader settings:', response.status, response.statusText);
const errorText = await response.text();
console.error('Error response body:', errorText);
}
} catch (error) {
console.error('Failed to load spreader settings:', error);