From 070a441fafc173dc286a884739da536903452736 Mon Sep 17 00:00:00 2001 From: Ricardo Cino Date: Sun, 26 Jun 2022 14:24:06 +0200 Subject: fix: solve recipe function calls that were broken cause of js=>ts con… (#369) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: solve recipe function calls that were broken cause of js=>ts conversion * fix: use an interface instead to keep type-safety * fix: remove faulty test --- src/models/Service.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/models/Service.ts') diff --git a/src/models/Service.ts b/src/models/Service.ts index c4165e59a..dfc074204 100644 --- a/src/models/Service.ts +++ b/src/models/Service.ts @@ -10,7 +10,7 @@ import { isValidExternalURL } from '../helpers/url-helpers'; import UserAgent from './UserAgent'; import { DEFAULT_SERVICE_ORDER } from '../config'; import { ifUndefined } from '../jsUtils'; -import Recipe from './Recipe'; +import { IRecipe } from './Recipe'; const debug = require('../preload-safe-debug')('Ferdium:Service'); @@ -18,7 +18,7 @@ const debug = require('../preload-safe-debug')('Ferdium:Service'); export default class Service { id: string = ''; - recipe: Recipe; + recipe: IRecipe; _webview: ElectronWebView | null = null; @@ -117,7 +117,7 @@ export default class Service { @observable proxy: string | null = null; - constructor(data, recipe: Recipe) { + constructor(data, recipe: IRecipe) { if (!data) { throw new Error('Service config not valid'); } @@ -270,8 +270,9 @@ export default class Service { ); } - if (typeof this.recipe.buildUrl === 'function') { - url = this.recipe.buildUrl(url); + const { buildUrl } = this.recipe; + if (typeof buildUrl === 'function') { + url = buildUrl(url); } return url; -- cgit v1.2.3-54-g00ecf