Infinitely posting data to server problem with using fetch POST in JavaScript

I am a university student and this is my first time of putting all together of server, api and client sides.

My problem is that first I have created an API using Django-Rest framework.
When I post data to that server using fetch function in JavaScript, it keeps posting that data and does not stop until I close. In the server database, many same data have been created.

I cannot figure out how to fix it. My intention was I want to post the data just once.
Please help me how to do it.

Thank you.