Skip to content

Commit

Permalink
Merge pull request #660 from enatega/fatima-networkissue
Browse files Browse the repository at this point in the history
Fixed Apollo Error When Saving Category Name with Highlighted Auto-Suggestion #639
  • Loading branch information
ufumerfarooq67 authored Nov 15, 2024
2 parents 47cd899 + 79c5aea commit 39fb028
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
20 changes: 12 additions & 8 deletions enatega-multivendor-admin/src/components/Category/Category.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const CREATE_CATEGORY = gql`
const EDIT_CATEGORY = gql`
${editCategory}
`

function Category(props) {
console.log("props",props);
const mutation = props.category ? EDIT_CATEGORY : CREATE_CATEGORY
const [mainError, mainErrorSetter] = useState('')
const [success, successSetter] = useState('')
Expand All @@ -24,20 +24,24 @@ function Category(props) {
)
const restaurantId = localStorage.getItem('restaurantId')
const onCompleted = data => {
console.log("category",props.category)
const message = props.category
? t('CategoryUpdatedSuccessfully')
: t('CategoryAddedSuccessfully')
successSetter(message)
mainErrorSetter('')
setCategory('')
setTimeout(hideAlert, 3000)
}
const onError = error => {
const message = `${t('ActionFailedTryAgain')} ${error}`
successSetter('')
mainErrorSetter(message)
setCategory('')
setTimeout(hideAlert, 3000)
}
const onError = (error) => {
let message = t('ActionFailedTryAgain');
if (error.message.includes('Category already exists')) {
message = error.message;
}
successSetter('');
mainErrorSetter(message);
setTimeout(hideAlert, 3000);
};
const [mutate, { loading }] = useMutation(mutation, { onError, onCompleted })
const hideAlert = () => {
mainErrorSetter('')
Expand Down
2 changes: 1 addition & 1 deletion enatega-multivendor-admin/src/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ConfigurationContext from '../context/Configuration'
const ConfigurableValues = () => {
const configuration = useContext(ConfigurationContext)

const SERVER_URL = 'https://enatega-multivendor.up.railway.app'
const SERVER_URL = 'https://enatega-multivendor.up.railway.app'
const WS_SERVER_URL = 'wss://enatega-multivendor.up.railway.app'
// const SERVER_URL = 'http://localhost:8001'
// const WS_SERVER_URL = 'ws://localhost:8001'
Expand Down
2 changes: 2 additions & 0 deletions enatega-multivendor-web/src/screens/Checkout/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ function Checkout() {
let costType = configuration.costType;
let amount = calculateAmount(costType, configuration.deliveryRate, distance);
setDeliveryCharges(amount > 0 ? amount : configuration.deliveryRate);

}
})();
}, [data, location]);
Expand Down Expand Up @@ -450,6 +451,7 @@ function Checkout() {
toggleCloseModal();
return;
}

if (!cart.length) {
showMessage({
type: "error",
Expand Down

0 comments on commit 39fb028

Please sign in to comment.