Skip to content

Commit

Permalink
edit firms fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sedadiriker authored May 9, 2024
1 parent aff2ee1 commit f8818f7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/components/FirmDetailModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ const FirmDetailModal = ({ open, handleClose, firm }) => {
if (selectedFirm) {
editFirm(selectedFirm._id, formData);
setEditMode(false);
handleClose()
getFirms()
// console.log(selectedFirm._id,formData)
handleClose()
} else {
console.error('Selected firm is undefined');
}
Expand Down
4 changes: 2 additions & 2 deletions src/features/firmSlice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ const firmSlice = createSlice({
editSuccess:(state,{payload}) => {
state.loading = false
const updatedFirm = payload
console.log("upp",updatedFirm)
// console.log("upp",updatedFirm)
state.firms = state.firms.map(firm => {
if(firm.id === updatedFirm.id) {
if(firm.id === updatedFirm._id) {
return updatedFirm
}
return firm
Expand Down
1 change: 0 additions & 1 deletion src/services/useStockRequest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const useStockRequest = () => {
try{
const {data} = await axiosToken.put(`/firms/${id}`,formData)
dispatch(editSuccess(data.new))
getFirms()
toastSuccessNotify("Firm updated successfully.");
}catch(err){
dispatch(fetchFail())
Expand Down

0 comments on commit f8818f7

Please sign in to comment.