Using onclick -- which could OVERWRITE other event handlers that other code may have attached, is NOT the answer. Either store that it's set, or do a removeEventListener (letting if fail on no match) before the add... which is a good time to use a real named function instead of some anonymous pointlessly cryptic arrow function BS. (not a fan)
Don’t even get me started about promises for people too stupid to handle event handlers, being shoved in where they’re just bloat for non-events, and the ugly “daisy chain for nothing” syntax that goes with them.
Because of as always writing two to ten times the code needed makes everything better.