Use Preferences abstraction instead of manual localStorage interaction

Default values and localStorage manipulation should be implemented in the
Prefereces class.
This commit is contained in:
Ealhad 2018-11-15 00:38:41 +01:00
parent 8049d4671e
commit 25b6e7949a
1 changed files with 2 additions and 1 deletions

View File

@ -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}`;