Hello I am trying to set my downloadUrl after uploading to firebase storage and I can't seem to get it to work with Redux Toolkit. I have a solution but I would rather have it the correct way but I cant seem to figure out it would love to get some feed back
Here is the Documentation example. I understand that numbers work differently than objects but if they can change it like this why cant I?
incrementByAmount: (state, action) => {
state.value += action.payload
},
And here is my code:
setImageUrl: (state, action: PayloadAction<string>) => {
state.imageUrl = action.payload;
},
And here is where I call it
const downloadUrl = await FirebaseStorageService.uploadFile(
photo,
setUploadProgress
);
dispatch(setImageUrl(downloadUrl));
Here is the error
ossible Unhandled Promise Rejection (id: 5):
TypeError: Cannot assign to read only property 'imageUrl' of object '#<Object>'
TypeError: Cannot assign to read only property 'imageUrl' of object '#<Object>'
Thank you in advance I have seen similar questions on other places but I feel like the answers are not clear. Can I change properties on an object directly or not with RTK?