From a3750859e3d63c5d7725a347d539ba7851b7e173 Mon Sep 17 00:00:00 2001 From: Ayushya Amitabh Date: Sat, 25 Jul 2020 23:16:41 -0400 Subject: [PATCH] v1.5.2/api update to handle remove localstorage key --- app/src/Api.js | 10 +++++++++- app/src/Create.js | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/Api.js b/app/src/Api.js index 30695d7..f7894f3 100644 --- a/app/src/Api.js +++ b/app/src/Api.js @@ -61,7 +61,15 @@ export const updateLocalData = (data) => { window.localStorage.setItem('WatchParty', JSON.stringify(Object.assign({}, LocalData(), data))); }; -export const emptyLocalData = () => window.localStorage.removeItem('WatchParty'); +export const removeLocalData = (key) => { + var data = LocalData(); + delete data[key]; + window.localStorage.setItem('WatchParty', JSON.stringify(data)); +}; + +export const emptyLocalData = () => { + window.localStorage.removeItem('WatchParty'); +}; export const getUserUid = async () => new Promise((resolve, reject) => { diff --git a/app/src/Create.js b/app/src/Create.js index 13ecd3a..34f16c3 100644 --- a/app/src/Create.js +++ b/app/src/Create.js @@ -58,7 +58,7 @@ export default class Create extends Component { } componentDidMount() { const { lastActive, userName, partyName, partyPin } = LocalData(); - if (userName && partyName && partyPin) { + if (lastActive && userName && partyName && partyPin) { if (Math.abs(new Date(parseInt(lastActive)) - new Date().getTime()) <= 60000) { this.props.updateLoading(true); this.joinCall(userName, partyName, partyPin);