<script lang="ts">
import { defineComponent } from "vue";
import { Input, Button } from "ant-design-vue";
import Icon from "ant-design-vue/es/icon";
import { message } from 'ant-design-vue';
import axios from 'axios';
export default defineComponent({
components: {
'a-input': Input,
'a-input-password': Input.Password,
'a-button': Button,
'a-icon': Icon
},
data() {
return {
email: '',
password: ''
};
},
methods: {
async handleSubmit() {
try {
const response = await axios.post('http://localhost:8000/auth/login', {
email: this.email,
password: this.password
});
console.log('Email:', this.email);
console.log('Password:', this.password);
console.log(response.data);
} catch (error) {
console.error('Login failed:', error);
message.error('Incorrect username or password.');
}
},
handleGoogleLogin() {
// Handle Google login
}
}
});
</script>
<script lang="ts">
import { defineComponent } from "vue";
import { Input, Button } from "ant-design-vue";
import Icon from "ant-design-vue/es/icon";
import { message } from 'ant-design-vue';
import axios from 'axios';
export default defineComponent({
components: {
'a-input': Input,
'a-input-password': Input.Password,
'a-button': Button,
'a-icon': Icon
},
data() {
return {
email: '',
password: ''
};
},
methods: {
async handleSubmit() {
try {
const response = await axios.post('http://localhost:8000/auth/login', {
email: this.email,
password: this.password
});
console.log('Email:', this.email);
console.log('Password:', this.password);
console.log(response.data);
} catch (error) {
console.error('Login failed:', error);
message.error('Incorrect username or password.');
}
},
handleGoogleLogin() {
// Handle Google login
}
}
});
</script>