Miorey / wow-model-viewer

A library for displaying interactive 3D models of World of Warcraft characters, items, and NPCs on your website using data from Wowhead. Customize the display with control over camera angles and animation.
https://miorey.github.io/wow-model-viewer/
56 stars 32 forks source link

refactor: clean, improve code quality, remove axios, closes #3 #12

Closed Helias closed 2 years ago

Helias commented 2 years ago

I would like to remove the https://wotlk.murlocvillage.com/ part, I don't think it's necessary, may in another PR if you agree

Miorey commented 2 years ago

@Helias first of all thanks for your PR, I will check it this days. about https://wotlk.murlocvillage.com do you refer to:

const resp = await fetch(`https://wotlk.murlocvillage.com/api/items/${item}/${displayId}`).then((response) => response.json());
        const res = resp.data ? resp.data : resp;

If yes it's not a good idea some stuff displayid have a new display id this endpoint allows to switch. Maybe I will create an independent endpoint so there will be no link with my private server.

Helias commented 2 years ago

Ok 👌, thanks for the quick response

Helias commented 2 years ago

@Miorey I added it because if I use demo.html and I change the race to "1" (human), I get error messages, that optional chaining it's to prevent that

Miorey commented 2 years ago

@Helias I like the it because it avoids errors on un-existing attributes child’s but it generates error in vue and webpack seems to not handle it properly. I will add a simple check even if it's dirtier it will let the lib functional in any case.