fehler behoben
This commit is contained in:
		@@ -1,49 +1,147 @@
 | 
			
		||||
import Axios from "axios";
 | 
			
		||||
// Initialize Firebase
 | 
			
		||||
var config = {
 | 
			
		||||
    apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
 | 
			
		||||
    authDomain: "test-667ca.firebaseapp.com",
 | 
			
		||||
    databaseURL: "https://test-667ca.firebaseio.com",
 | 
			
		||||
    projectId: "test-667ca",
 | 
			
		||||
    storageBucket: "test-667ca.appspot.com",
 | 
			
		||||
    messagingSenderId: "221332577314"
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
firebase.initializeApp(config);
 | 
			
		||||
 | 
			
		||||
    M.AutoInit();
 | 
			
		||||
    //initialize all modals           
 | 
			
		||||
    $('.modal').modal({
 | 
			
		||||
        dismissible: false
 | 
			
		||||
    });
 | 
			
		||||
var app = new Vue({
 | 
			
		||||
    el: ".myapp",
 | 
			
		||||
    data: {
 | 
			
		||||
        title: "smartshopper.cf",
 | 
			
		||||
        myshoppinglists: [],
 | 
			
		||||
        sharedshoppinglists: [],
 | 
			
		||||
        currentlist: {}
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Initialize Firebase
 | 
			
		||||
    var config = {
 | 
			
		||||
        apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
 | 
			
		||||
        authDomain: "test-667ca.firebaseapp.com",
 | 
			
		||||
        databaseURL: "https://test-667ca.firebaseio.com",
 | 
			
		||||
        projectId: "test-667ca",
 | 
			
		||||
        storageBucket: "test-667ca.appspot.com",
 | 
			
		||||
        messagingSenderId: "221332577314"
 | 
			
		||||
    };
 | 
			
		||||
    methods: {
 | 
			
		||||
        deleteShoppinglist(sl_id) {
 | 
			
		||||
 | 
			
		||||
            firebase.auth().onAuthStateChanged(function (user) {
 | 
			
		||||
                if (user) {
 | 
			
		||||
                    firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
 | 
			
		||||
                        axios({
 | 
			
		||||
                            method: 'delete',
 | 
			
		||||
                            url: "/shoppinglist",
 | 
			
		||||
                            data: {
 | 
			
		||||
                                sl_id: sl_id,
 | 
			
		||||
                                idtoken: idtoken
 | 
			
		||||
                            }
 | 
			
		||||
                        }).then((res) => {
 | 
			
		||||
                            app.myshoppinglists = res.data;
 | 
			
		||||
                        });
 | 
			
		||||
                    }).catch((error) => console.error("Get id token client error: ", error));
 | 
			
		||||
                } else {
 | 
			
		||||
                    console.log("Check Auth error", user)
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
    firebase.initializeApp(config);
 | 
			
		||||
 | 
			
		||||
    var app = new Vue({
 | 
			
		||||
        el: "myapp",
 | 
			
		||||
        data: {
 | 
			
		||||
            myshoppinglists: [],
 | 
			
		||||
            sharedshoppinglists: []
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        methods: {
 | 
			
		||||
            fetchData: function() {
 | 
			
		||||
                firebase.auth().onAuthStateChanged(function (user) {
 | 
			
		||||
                    if (user) {
 | 
			
		||||
                        firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
 | 
			
		||||
                            alert("LALALALAL");
 | 
			
		||||
                        }).catch((error) => console.error("Get id token client error: ", error));
 | 
			
		||||
                    } else {
 | 
			
		||||
                        console.log("Check Auth error", user)
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        getShoppinglistDetail(sl_id) {
 | 
			
		||||
 | 
			
		||||
            axios({
 | 
			
		||||
                method: 'get',
 | 
			
		||||
                url: "/shoppinglist_json/" + sl_id,
 | 
			
		||||
 | 
			
		||||
            }).then((res) => {
 | 
			
		||||
                app.currentlist = res.data;
 | 
			
		||||
                console.log(res.data);
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        mounted() {
 | 
			
		||||
            this.fetchData();
 | 
			
		||||
        createShoppinglist(name, description) {
 | 
			
		||||
            firebase.auth().onAuthStateChanged(function (user) {
 | 
			
		||||
                if (user) {
 | 
			
		||||
                    firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
 | 
			
		||||
                        axios({
 | 
			
		||||
                            method: 'post',
 | 
			
		||||
                            url: "/shoppinglist",
 | 
			
		||||
                            data: {
 | 
			
		||||
                                name: name,
 | 
			
		||||
                                description: description,
 | 
			
		||||
                                color: "white",
 | 
			
		||||
                                idtoken: idtoken
 | 
			
		||||
                            }
 | 
			
		||||
                        }).then((res) => {
 | 
			
		||||
                            app.myshoppinglists = res.data;
 | 
			
		||||
                        });
 | 
			
		||||
                    }).catch((error) => console.error("Get id token client error: ", error));
 | 
			
		||||
                } else {
 | 
			
		||||
                    console.log("Check Auth error", user)
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
  
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    created() {
 | 
			
		||||
 | 
			
		||||
        firebase.auth().onAuthStateChanged(function (user) {
 | 
			
		||||
            if (user) {
 | 
			
		||||
                firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
 | 
			
		||||
                    axios.get('/myshoppinglists?idtoken=' + idtoken)
 | 
			
		||||
                        .then(function (res) {
 | 
			
		||||
 | 
			
		||||
                            app.myshoppinglists = res.data;
 | 
			
		||||
                            console.log(res.data);
 | 
			
		||||
                        })
 | 
			
		||||
                        .catch(function (error) {
 | 
			
		||||
 | 
			
		||||
                            console.log(error);
 | 
			
		||||
                        })
 | 
			
		||||
                        .then(function () {
 | 
			
		||||
 | 
			
		||||
                        });
 | 
			
		||||
                }).catch((error) => console.error("Get id token client error: ", error));
 | 
			
		||||
            } else {
 | 
			
		||||
                console.log("Check Auth error", user)
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        firebase.auth().onAuthStateChanged(function (user) {
 | 
			
		||||
            if (user) {
 | 
			
		||||
                firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (idtoken) {
 | 
			
		||||
                    axios.get('sharedshoppinglists?idtoken=' + idtoken)
 | 
			
		||||
                        .then(function (res) {
 | 
			
		||||
 | 
			
		||||
                            app.sharedshoppinglists = res.data;
 | 
			
		||||
                            console.log(res.data);
 | 
			
		||||
                        })
 | 
			
		||||
                        .catch(function (error) {
 | 
			
		||||
 | 
			
		||||
                            console.log(error);
 | 
			
		||||
                        })
 | 
			
		||||
                        .then(function () {
 | 
			
		||||
 | 
			
		||||
                        });
 | 
			
		||||
                }).catch((error) => console.error("Get id token client error: ", error));
 | 
			
		||||
            } else {
 | 
			
		||||
                console.log("Check Auth error", user)
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
$(document).ready(function(){
 | 
			
		||||
    $('.collapsible').collapsible();
 | 
			
		||||
    $('.modal').modal();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
$(document).on("click", ".citemL", function () {
 | 
			
		||||
    $(".activeL").removeClass("activeL");
 | 
			
		||||
    $(this).addClass("activeL");
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
$(".nav-createlist").click(function() {
 | 
			
		||||
    $('#modal1').modal("open");
 | 
			
		||||
});
 | 
			
		||||
@@ -1,3 +1,20 @@
 | 
			
		||||
body {
 | 
			
		||||
    background-color: rgb(238, 238, 238);
 | 
			
		||||
    background-color: rgb(240, 240, 240) !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.msl {
 | 
			
		||||
    color: rgb(56, 56, 56) !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.activeL {
 | 
			
		||||
    background-color: #e53935 !important;
 | 
			
		||||
    color: #f0f0f0 !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.ico {
 | 
			
		||||
    color: #bdbdbd !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.brand-logo {
 | 
			
		||||
    margin-left: 30px !important;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11926
									
								
								express-server/public/test/vue.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11926
									
								
								express-server/public/test/vue.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user