init
This commit is contained in:
47
src/App.vue
Normal file
47
src/App.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<script setup lang="ts">
|
||||
import WebSocketComponent from '@/components/WebSocketComponent.vue'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const email = ref('vadim.olonin@gmail.com')
|
||||
|
||||
async function onSubmit() {
|
||||
console.log('onSubmit')
|
||||
|
||||
try {
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ email: email.value }),
|
||||
}
|
||||
const res = await fetch('http://localhost:5173/login', options)
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
|
||||
console.log(data)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div>chat</div>
|
||||
<form @submit.prevent="onSubmit">
|
||||
<div>login</div>
|
||||
<div>
|
||||
<input v-model="email" placeholder="email" type="email" />
|
||||
<button>login</button>
|
||||
</div>
|
||||
</form>
|
||||
<hr />
|
||||
<div>
|
||||
<WebSocketComponent />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
Reference in New Issue
Block a user