Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pouchdb db.login is not a function

Tried using these imports

import PouchDB from 'pouchdb';
import PouchDBAuth from 'pouchdb-authentication';

PouchDB.plugin(PouchDBAuth)

Module ''pouchdb-authentication'' has no default export is the error generated while using these imports.

PouchDB.plugin(require('pouchdb-authentication'));

Using require is removing the error but still showing db.login() is not a function.Can anyone suggest where the issue is?

like image 586
shalini Avatar asked Jan 20 '18 09:01

shalini


1 Answers

Well I found why it was not working in my situation, I was using this :

import '*' as PouchDBAuthentication from 'pouchdb-authentication';

instead of

import PouchDBAuthentication from 'pouchdb-authentication';

So the right way is

import PouchDBAuthentication from 'pouchdb-authentication';
import PouchDB from 'pouchdb';

PouchDB.plugin(PouchDBAuthentication);

In the second hand the following steps should be done : https://github.com/pouchdb-community/pouchdb-authentication/issues/211

like image 57
Ostn Avatar answered Oct 29 '22 03:10

Ostn