You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello guys, I'm studying the module 2 and I found one problem in faker library. This problem is caused because the 'Faker' library does not exists anymore.
I recommend that you use this library: @faker-js/faker
And in miragejs/factories/user.js, you can use this code:
import{randomNumber}from'./utils';import{Factory}from'miragejs';import{faker}from'@faker-js/faker';exportdefault{user: Factory.extend({name(){returnfaker.name.fullName();},mobile(){returnfaker.unique(faker.datatype.uuid);},afterCreate(user,server){constmessages=server.createList('message',randomNumber(10),{ user });user.update({ messages });},}),};
Have a good code study!👊👨💻👩💻
Português
Olá pessoal, estou estudando o módulo 2 e encontrei um problema na biblioteca faker. Este problema é causado porque a biblioteca 'Faker' não existe mais.
Eu recomendo que você use esta biblioteca: @faker-js/faker
Para evitar alertas no console de quem instalou o faker-js acima da versão 7.5 deve adicionar o helpers antes do unique no método mobile do arquivo user.js.
English
Hello guys, I'm studying the module 2 and I found one problem in faker library. This problem is caused because the 'Faker' library does not exists anymore.
I recommend that you use this library:
@faker-js/faker
Click here to know more about this library
You can install with yarn and npm:
Code recommendation
In miragejs/factories/message.js, you can use this code:
And in miragejs/factories/user.js, you can use this code:
Have a good code study!👊👨💻👩💻
Português
Olá pessoal, estou estudando o módulo 2 e encontrei um problema na biblioteca faker. Este problema é causado porque a biblioteca 'Faker' não existe mais.
Eu recomendo que você use esta biblioteca:
@faker-js/faker
Clique aqui para saber mais sobre esta biblioteca
Você pode instalar com yarn e npm:
Recomendação de código
No miragejs/factories/message.js, você pode usar este código:
E no miragejs/factories/user.js, você pode usar este código:
Tenha um ótimo estudo de código!!👊👨💻👩💻
The text was updated successfully, but these errors were encountered: