From 25b6e7949a9f1e2d2b502c51da4340ad82ca88ac Mon Sep 17 00:00:00 2001 From: Ealhad Date: Thu, 15 Nov 2018 00:38:41 +0100 Subject: [PATCH] Use Preferences abstraction instead of manual localStorage interaction Default values and localStorage manipulation should be implemented in the Prefereces class. --- src/peertube-api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/peertube-api.ts b/src/peertube-api.ts index 5515759..2f353a4 100644 --- a/src/peertube-api.ts +++ b/src/peertube-api.ts @@ -16,9 +16,10 @@ import * as _ from 'lodash/fp'; import constants from './constants'; +import Preferences from './preferences'; async function fetchAPI(path: string, query?: Object) { - const instance = _.getOr(constants.peertubeAPI.defaultInstance, 'searchInstance', await browser.storage.local.get()).toString(); + const instance = (await Preferences.getPreferences()).searchInstance; let url = `https://${instance}/${constants.peertubeAPI.endpoint}/${path}`;