Skip to content

Commit

Permalink
chore: updated couter patch
Browse files Browse the repository at this point in the history
  • Loading branch information
SaraBianchi committed Dec 28, 2024
1 parent 23c7ecf commit ec4a0ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function resetCounter({ path, value }) {
type: RESET_COUNTER,
request: {
op: 'patch',
path: `${path}/@reset-counter`,
path: `${path}/@counter`,
data: { counter_value: value },
},
};
Expand Down
9 changes: 9 additions & 0 deletions src/components/Widgets/CounterWidget/CounterWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ const CounterWidget = (props) => {
}, [resetCounterState]);

// initialized form counter input
useEffect(() => {
dispatch(
getCounterValue({
path: getBaseUrl(location?.pathname || ''),
}),
);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
if (counterValue) {
setCounterInput(counterValue);
Expand Down

0 comments on commit ec4a0ad

Please sign in to comment.