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:
parent
8049d4671e
commit
25b6e7949a
|
@ -16,9 +16,10 @@
|
||||||
|
|
||||||
import * as _ from 'lodash/fp';
|
import * as _ from 'lodash/fp';
|
||||||
import constants from './constants';
|
import constants from './constants';
|
||||||
|
import Preferences from './preferences';
|
||||||
|
|
||||||
async function fetchAPI(path: string, query?: Object) {
|
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}`;
|
let url = `https://${instance}/${constants.peertubeAPI.endpoint}/${path}`;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue