1
0
mirror of https://github.com/actix/examples synced 2025-02-20 08:20:32 +01:00

Update app.vue

This commit is contained in:
krircc 2019-03-30 09:47:04 +08:00 committed by GitHub
parent a3bef842e7
commit 1d3b392ac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,45 +22,50 @@
</template> </template>
<script> <script>
import axios from 'axios'
export default { export default {
name: 'app', name: 'app',
data () { data () {
return { return {
Username: '', Username: '',
Email: '', Email: '',
Password: '', Password: '',
ConfirmPassword: '', ConfirmPassword: '',
email: '', email: '',
username: '', username: '',
password: '' password: ''
} }
}, },
methods: { methods: {
signup () { signup () {
var username = this.Username let username = this.Username
var email = this.Email let email = this.Email
var password = this.Password let password = this.Password
var confirm_password = this.ConfirmPassword let confirm_password = this.ConfirmPassword
console.log(email) let data = {
axios.post('http://localhost:8000/user/info', { username: username,
username: username, email: email,
email: email, password: password,
password: password, confirm_password: confirm_password
confirm_password: confirm_password }
}) fetch('http://localhost:8000/user/info', {
.then(response => { body: JSON.stringify(data),
console.log(response.data) headers: {
this.email = response.data.email 'content-type': 'application/json'
this.username = response.data.username },
this.password = response.data.password method: 'POST',
}) }).then(response => response.json())
.catch(e => { .then(json => {
console.log(e) console.log(json)
}) this.email = json.email
} this.username = json.username
} this.password = json.password
})
.catch((e) => {
console.log(e)
})
}
}
} }
</script> </script>
@ -95,7 +100,6 @@ input[type="password"] {
border-radius: 2px; border-radius: 2px;
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
font-weight: bold; font-weight: bold;
text-transform: uppercase;
transition: 0.1s ease; transition: 0.1s ease;
cursor: pointer; cursor: pointer;
} }
@ -142,4 +146,4 @@ cursor: pointer;
padding-top: 100px; padding-top: 100px;
} }
} }
</style> </style>