From d9fb4f2d679a242895cc93013c7e612c9f8f70a0 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 24 Jan 2018 13:27:58 -0500 Subject: [PATCH] proper typings --- src/background/runtime.background.ts | 25 ++++++++++---------- src/popup/app/settings/settings.component.ts | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/background/runtime.background.ts b/src/background/runtime.background.ts index 3845c463dc..627d2fbf5d 100644 --- a/src/background/runtime.background.ts +++ b/src/background/runtime.background.ts @@ -1,5 +1,8 @@ import { CipherType } from 'jslib/enums'; +import { CipherView } from 'jslib/models/view/cipherView'; +import { LoginView } from 'jslib/models/view/loginView'; + import { ConstantsService } from 'jslib/services/constants.service'; import { UtilsService } from 'jslib/services/utils.service'; @@ -176,20 +179,16 @@ export default class RuntimeBackground { this.main.loginsToAdd.splice(i, 1); - const cipher = await this.cipherService.encrypt({ - id: null, - folderId: null, - favorite: false, - name: loginInfo.name, - notes: null, - type: CipherType.Login, - login: { - uri: loginInfo.uri, - username: loginInfo.username, - password: loginInfo.password, - }, - }); + const loginModel = new LoginView(); + loginModel.uri = loginInfo.uri; + loginModel.username = loginInfo.username; + loginModel.password = loginInfo.password; + const model = new CipherView(); + model.name = loginInfo.name; + model.type = CipherType.Login; + model.login = loginModel; + const cipher = await this.cipherService.encrypt(model); await this.cipherService.saveWithServer(cipher); this.analytics.ga('send', { hitType: 'event', diff --git a/src/popup/app/settings/settings.component.ts b/src/popup/app/settings/settings.component.ts index 6fdf465f06..f6abe2bfa0 100644 --- a/src/popup/app/settings/settings.component.ts +++ b/src/popup/app/settings/settings.component.ts @@ -158,7 +158,7 @@ export class SettingsController { rate() { this.$analytics.eventTrack('Rate Extension'); - BrowserApi.createNewTab(RateUrls[this.platformUtilsService.getDevice()]); + BrowserApi.createNewTab((RateUrls as any)[this.platformUtilsService.getDevice()]); } }