I’m not exactly sure just yet but …
this await is unnecessary.
the response should already be an object so not sure why you need the .json() etc. ? You can probably simplify this a lot
you don’t need to pass this as the tracked variables are in scope throughout the Component, so just call it and refer to it in the action.
Some style tips:
- don’t smother your shared code with console.logs, that makes it harder to see the wood for the trees
- use two space indentation not 4 which is a discourse standard. See your template
- consider moving this into a dedicated .gjs file
- you can click on the numbers in github and get a shareable link which previews the code if you need.
advanced:
- set up Prettier and ESlint … the former for style and the latter for both style and it might help you catch some bugs.