Py学习  »  MongoDB

尝试使用本机脚本在mongodb中存储详细信息

Janani Ashok • 4 年前 • 559 次点击  

我试图使用本机脚本在mongodb中存储用户详细信息,但它存储的是空值。电子邮件和密码存储在mongo db中,但它存储的是空值。我不知道问题在哪里。

<template>
<Page>
    <ActionBar title="Registerme" />
    <ScrollView>
        <StackLayout id= "register" class="registered">
            <TextField class="email"></TextField>
            <TextField class="password"></TextField>
            <Button text="Register" @tap="onRegisterTap" />
        </StackLayout>
    </ScrollView>
</Page>
</template>

<script>
export default {
name: "register",
data() {
return {
email: "",
password: ""
       };
    },
    methods: {
        onRegisterTap() {
            console.log("submitted..");
            const userdetails = {
                email: this.email,
                password: this.password
            };
            const options = {
                method: "POST",
                headers: {
                    "Content-Type": "application/json"
                },
                body: JSON.stringify(userdetails)
            };
            fetch("https://374b5b7a.ngrok.io/register", options)
                .then(response => {
                    console.log("success", response);
                })
                .catch(error => {
                    console.error("Error:", error);
                });
        }
    }
}
</script>
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/56029
 
559 次点击