It seems like the error is occuring during the preflight request that the client is making. The server isn’t handling the OPTIONS request type, which is what the preflight is, so it’s causing the error and in turn the client also fails on the preflight request.
It’s a bit hard for me to tell you exactly how to fix it, but look into what a preflight request is and how to handle it. Maybe ChatGPT could point you in the right direction as well.