Reading property of then undifiend

LoginPage.html:27 ERROR TypeError: Cannot read property ‘then’ of undefined
at LoginPage.push…/src/app/pages/login/ (
at Object.eval [as handleEvent] (LoginPage.html:27)
at handleEvent (core.js:23097)
at callWithDebugContext (core.js:24167)
at Object.debugHandleEvent [as handleEvent] (core.js:23894)
at dispatchEvent (core.js:20546)
at core.js:20993
at HTMLElement. (platform-browser.js:993)
at ZoneDelegate.push…/node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:17280).
this is the error i get when done the below code
on buttton click calling function login(), in login() creating db and tables

login() {
name: ‘prompt_db’,
location: ‘default’
.then((db: SQLiteObject) => {
// tslint:disable-next-line:max-line-length
db.executeSql('create table if not exists users (id int(100) primary key, name varchar(32), username varchar(32)) unique, password varchar(32) ', )
.then(() => console.log('executed sql '))
.catch(e => console.log(e));
.catch(e => console.log(e));