openedx/frontend-app-learner-dashboard

Unenrolling from Course is not working

Closed this issue · 5 comments

When I try to unenroll from a course, the API gives error. As the API is requesting the default .env.development variable which is http://localhost:18000. But it should request to LMS_BASE_URL provided in the MFE_CONFIG settings. When printing the getConfig().LMS_BASE_URL , it is printing the correct URL.
image

Further debugging leads me to this conclusion:
Here, the variable is setting the first time value of LMS_BASE_URL because till then mergeConfig hasn't been run.
For further reading, This link can be helpful. Link

I believe making courseUneroll a function instead of a variable will fix the issue, so that courseUnenroll url picks the latest/current value of LMS_BASE_URL. If this seems good, I am willing to work on it.

Thanks for your report! The Aperture team will be tracking this internally as ticket APER-3566.

Hi @hinakhadim , the Aperture and I talked about this issue during our meeting, and we're okay with you continuing to pursue a fix for this if you have the time. I think your approach of converting the variable into a function to fetch the appropriate URL is a viable option. Let us know if you have any questions!

Hey everyone,
Thanks for your time. I think that this issue should close automatically after merging this PR.

#273 closes this issue