mirror of
https://github.com/chinchang/web-maker.git
synced 2025-08-02 19:37:29 +02:00
remove user creation
This commit is contained in:
@@ -164,6 +164,10 @@ export default class ContentWrap extends Component {
|
|||||||
log('✉️ Sending message to detached window');
|
log('✉️ Sending message to detached window');
|
||||||
this.detachedWindow.postMessage({ contents }, '*');
|
this.detachedWindow.postMessage({ contents }, '*');
|
||||||
} else {
|
} else {
|
||||||
|
// 1. we refresh the frame so that all JS is cleared in the frame. this will
|
||||||
|
// break the iframe since sandboxed frame isn't served by SW (needed for offline support)
|
||||||
|
// 2. we cache and remove the sandbox attribute and refresh again so that it gets served by SW
|
||||||
|
// 3. we add back cached sandbox attr & write the contents to the iframe
|
||||||
const refreshAndDo = fn => {
|
const refreshAndDo = fn => {
|
||||||
Promise.race([
|
Promise.race([
|
||||||
// Just in case onload promise doesn't resolves
|
// Just in case onload promise doesn't resolves
|
||||||
@@ -179,7 +183,7 @@ export default class ContentWrap extends Component {
|
|||||||
};
|
};
|
||||||
const writeInsideIframe = () => {
|
const writeInsideIframe = () => {
|
||||||
const sandbox = this.frame.getAttribute('sweet');
|
const sandbox = this.frame.getAttribute('sweet');
|
||||||
// console.log('setting back sandbox attr', sandbox);
|
console.log('setting back sandbox attr', sandbox);
|
||||||
this.frame.setAttribute('sandbox', sandbox);
|
this.frame.setAttribute('sandbox', sandbox);
|
||||||
this.frame.removeAttribute('sweet');
|
this.frame.removeAttribute('sweet');
|
||||||
// console.log('sending postmessage');
|
// console.log('sending postmessage');
|
||||||
@@ -190,7 +194,7 @@ export default class ContentWrap extends Component {
|
|||||||
};
|
};
|
||||||
refreshAndDo(() => {
|
refreshAndDo(() => {
|
||||||
const sandbox = this.frame.getAttribute('sandbox');
|
const sandbox = this.frame.getAttribute('sandbox');
|
||||||
// console.log('removing sandbox', sandbox);
|
console.log('removing sandbox', sandbox);
|
||||||
this.frame.setAttribute('sweet', sandbox);
|
this.frame.setAttribute('sweet', sandbox);
|
||||||
this.frame.removeAttribute('sandbox');
|
this.frame.removeAttribute('sandbox');
|
||||||
refreshAndDo(writeInsideIframe);
|
refreshAndDo(writeInsideIframe);
|
||||||
|
16
src/db.js
16
src/db.js
@@ -147,13 +147,15 @@ function getArrayFromQuerySnapshot(querySnapshot) {
|
|||||||
.doc(`users/${userId}`)
|
.doc(`users/${userId}`)
|
||||||
.get()
|
.get()
|
||||||
.then(doc => {
|
.then(doc => {
|
||||||
if (!doc.exists)
|
if (!doc.exists) {
|
||||||
return remoteDb.doc(`users/${userId}`).set(
|
// return remoteDb.doc(`users/${userId}`).set(
|
||||||
{},
|
// {},
|
||||||
{
|
// {
|
||||||
merge: true
|
// merge: true
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
return {};
|
||||||
|
}
|
||||||
const user = doc.data();
|
const user = doc.data();
|
||||||
Object.assign(window.user, user);
|
Object.assign(window.user, user);
|
||||||
return user;
|
return user;
|
||||||
|
Reference in New Issue
Block a user