create user after login
This commit is contained in:
		@@ -6,19 +6,8 @@ const stringSimilarity = require('string-similarity');
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function updateUser(uid, mid) {
 | 
					async function updateUser(uid, mid) {
 | 
				
			||||||
    try {      
 | 
					    try {      
 | 
				
			||||||
        let exists = await query('SELECT row_to_json("User") AS obj FROM "User" WHERE username = $1;', [uid]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        console.log(exists);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
       //existiert
 | 
					 | 
				
			||||||
        if(exists != undefined) {
 | 
					 | 
				
			||||||
            await nonQuery('UPDATE "User" SET message_id = $1 WHERE username = $2', [mid, uid]);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        //existiert nicht
 | 
					 | 
				
			||||||
        else {
 | 
					 | 
				
			||||||
        await nonQuery('INSERT INTO "User" (username, message_id) VALUES ($1, $2);', [uid, mid]);
 | 
					        await nonQuery('INSERT INTO "User" (username, message_id) VALUES ($1, $2);', [uid, mid]);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    catch (error) {
 | 
					    catch (error) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ var vue = new Vue({
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    mounted() {
 | 
					    mounted() {
 | 
				
			||||||
        axios.post('/user', {
 | 
					        /*axios.post('/user', {
 | 
				
			||||||
            message_id: 'test',
 | 
					            message_id: 'test',
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
          .then(function (response) {
 | 
					          .then(function (response) {
 | 
				
			||||||
@@ -80,6 +80,6 @@ var vue = new Vue({
 | 
				
			|||||||
          })
 | 
					          })
 | 
				
			||||||
          .catch(function (error) {
 | 
					          .catch(function (error) {
 | 
				
			||||||
            console.log(error);
 | 
					            console.log(error);
 | 
				
			||||||
          });
 | 
					          });*/
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
@@ -44,7 +44,7 @@ var config = {
 | 
				
			|||||||
  firebase.initializeApp(config);
 | 
					  firebase.initializeApp(config);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getAllShoppinglists();
 | 
					  getAllShoppinglists();
 | 
				
			||||||
  //updateUser();
 | 
					  updateUser();
 | 
				
			||||||
  displayShoppinglist();
 | 
					  displayShoppinglist();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function movePurchases(text) {
 | 
					function movePurchases(text) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user