1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-08-01 19:10:22 +02:00

remove user creation

This commit is contained in:
Kushagra Gour
2024-04-26 18:14:50 +05:30
parent 54750d6ac1
commit 3e9a947527
2 changed files with 15 additions and 9 deletions

View File

@@ -164,6 +164,10 @@ export default class ContentWrap extends Component {
log('✉️ Sending message to detached window');
this.detachedWindow.postMessage({ contents }, '*');
} 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 => {
Promise.race([
// Just in case onload promise doesn't resolves
@@ -179,7 +183,7 @@ export default class ContentWrap extends Component {
};
const writeInsideIframe = () => {
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.removeAttribute('sweet');
// console.log('sending postmessage');
@@ -190,7 +194,7 @@ export default class ContentWrap extends Component {
};
refreshAndDo(() => {
const sandbox = this.frame.getAttribute('sandbox');
// console.log('removing sandbox', sandbox);
console.log('removing sandbox', sandbox);
this.frame.setAttribute('sweet', sandbox);
this.frame.removeAttribute('sandbox');
refreshAndDo(writeInsideIframe);

View File

@@ -147,13 +147,15 @@ function getArrayFromQuerySnapshot(querySnapshot) {
.doc(`users/${userId}`)
.get()
.then(doc => {
if (!doc.exists)
return remoteDb.doc(`users/${userId}`).set(
{},
{
merge: true
}
);
if (!doc.exists) {
// return remoteDb.doc(`users/${userId}`).set(
// {},
// {
// merge: true
// }
// );
return {};
}
const user = doc.data();
Object.assign(window.user, user);
return user;