rhodesman / teslaPowerDash

GNU General Public License v3.0
85 stars 11 forks source link

Correctly save pwSettings file #15

Open mgb opened 3 years ago

mgb commented 3 years ago

When attempting to save the settings file, the javascript would incorrectly append '/api' to the end of the middleware IP address. Once that issue was addressed, nodemon would detect that the saved file has changed, and restart the server preventing the output of the API token and suggested URL.

natewalck commented 3 years ago

Perhaps this should also only append /api if it is already not present. That would prevent user error or other bugs down the line.

I solved this same issue like this:

    if (!formSettings[1].value.includes('/api')) {
      formSettings[1].value = formSettings[1].value + '/api';
    }