v1.5.2/api update to handle remove localstorage key

This commit is contained in:
2020-07-25 23:16:41 -04:00
parent a06cc15040
commit a3750859e3
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -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) => {
+1 -1
View File
@@ -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);