javascript icon indicating copy to clipboard operation
javascript copied to clipboard

Not able to use getCities method

Open rodmirsantana opened this issue 6 years ago • 5 comments

Hey guys, I'm trying to use the getCities method but I'm getting: Uncaught TypeError: (0 , _brazilianUtils.getCities) is not a function error on the console. I installed the lib using yarn and I'm importing it in my js file as below. What could be the issue?

import { getCities } from '@brazilian-utils/brazilian-utils';
...

const Methods = {
async init() {
    await Methods.getCitiesList();
 }

getSelectedOption(sel) {
     var opt;
     for (var i = 0, len = sel.options.length; i < len; i++) {
       opt = sel.options[i];
       if (opt.selected === true) {
         break;
       }
     }
     return opt;
   },

async getCitiesList() {
     Elements.selectState.addEventListener('change', (el) => {
       const selectedState = Methods.getSelectedOption(Elements.selectState).value;
       const citiesList = getCities(selectedState);
       console.log(citiesList);
     });
   },

};

rodmirsantana avatar Jun 17 '20 20:06 rodmirsantana

Sorry about that @rodmirsantana, I will publish a new version with this method right now! Just sec...

hyanmandian avatar Jun 17 '20 21:06 hyanmandian

I published version 1.0.0-rc.8. I think that now you just need to update our package in your project. Again, sorry about that, I forgot to publish the latest feature merged :(

Can you check and tell us if it works?

hyanmandian avatar Jun 17 '20 21:06 hyanmandian

@hyanmandian I tried both yarn add @brazilian-utils/brazilian-utils and npm install @brazilian-utils/brazilian-utils, but still got version 1.0.0-rc.7. Can you double-check please?

rodmirsantana avatar Jun 18 '20 11:06 rodmirsantana

Please, try again. I updated the latest tag on NPM right now. You can check here: https://www.npmjs.com/package/@brazilian-utils/brazilian-utils (just click on version).

hyanmandian avatar Jun 18 '20 12:06 hyanmandian

I've tried here and managed to update now! Thank you.

rodmirsantana avatar Jun 18 '20 13:06 rodmirsantana