v1.3.0-beta/UI redone
This commit is contained in:
+14
-4
@@ -1,9 +1,9 @@
|
||||
/*global chrome*/
|
||||
|
||||
const API_HOST = window.location.href.startsWith('http://localhost')
|
||||
? 'http://localhost:5001/watch-party-crx/us-central1/widgets'
|
||||
: // : 'http://localhost:5001/watch-party-crx/us-central1/widgets';
|
||||
'https://us-central1-watch-party-crx.cloudfunctions.net/widgets';
|
||||
? 'http://localhost:5000/watch-party-crx/us-central1/widgets'
|
||||
: // : 'https://us-central1-watch-party-crx.cloudfunctions.net/widgets';
|
||||
'http://localhost:5000/watch-party-crx/us-central1/widgets';
|
||||
|
||||
export const PLAYER_STATUS = {
|
||||
PLAYING: 'PLAYING',
|
||||
@@ -32,6 +32,16 @@ export const getPlayerSource = () => {
|
||||
if (HREF.startsWith(PLAYER_SOURCE.LOCAL)) return PLAYER_SOURCE.LOCAL;
|
||||
};
|
||||
|
||||
export const LocalData = () => {
|
||||
return JSON.parse(window.localStorage.getItem('WatchParty')) || {};
|
||||
};
|
||||
|
||||
export const updateLocalData = (data) => {
|
||||
window.localStorage.setItem('WatchParty', JSON.stringify(Object.assign({}, LocalData(), data)));
|
||||
};
|
||||
|
||||
export const emptyLocalData = () => window.localStorage.setItem('WatchParty', undefined);
|
||||
|
||||
export const getUserUid = async () =>
|
||||
new Promise((resolve, reject) => {
|
||||
chrome.runtime.sendMessage(
|
||||
@@ -40,7 +50,7 @@ export const getUserUid = async () =>
|
||||
},
|
||||
(response) => {
|
||||
const { uid } = response;
|
||||
window.localStorage.setItem('watchPartyUserUid', uid);
|
||||
updateLocalData({ userUid: uid });
|
||||
resolve(uid);
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user