initial commit

This commit is contained in:
Zoe
2023-01-03 09:29:04 -06:00
commit 7851137d88
12889 changed files with 2557443 additions and 0 deletions

7
pages/channel/[id].vue Normal file
View File

@@ -0,0 +1,7 @@
<template>
hello world
</template>
<script setup>
$fetch('/api/getChannelById', { params: { test: 123 } })
</script>

7
pages/index.vue Normal file
View File

@@ -0,0 +1,7 @@
<template>
<div>
Hello there
<nuxt-link to="/login">Login</nuxt-link>
<nuxt-link to="/signup">Signup</nuxt-link>
</div>
</template>

42
pages/login.vue Normal file
View File

@@ -0,0 +1,42 @@
<template>
<form class="flex flex-col"
@submit.prevent="signup()">
<input class="border border-zinc-700"
name="username"
v-model="username"
placeholder="username" />
<input class="border border-zinc-700"
name="password"
type="password"
v-model="password"
placeholder="password" />
<input type="submit" />
</form>
</template>
<script>
export default {
data() {
return {
username: '',
password: ''
}
},
methods: {
async signup() {
if (!this.username || !this.password) return;
const user = await $fetch('/api/login', {
method: 'post', body: {
username: this.username,
password: this.password
}
})
const userId = useCookie('userId')
userId.value = user.userId
const token = useCookie('sessionToken')
token.value = user.token
}
}
}
</script>

48
pages/signup.vue Normal file
View File

@@ -0,0 +1,48 @@
<template>
<form class="flex flex-col"
@submit.prevent="signup()">
<input class="border border-zinc-700"
name="username"
v-model="username"
placeholder="username" />
<input class="border border-zinc-700"
name="email"
v-model="email"
placeholder="email" />
<input class="border border-zinc-700"
name="password"
type="password"
v-model="password"
placeholder="password" />
<input type="submit" />
</form>
</template>
<script>
export default {
data() {
return {
username: '',
email: '',
password: ''
}
},
methods: {
async signup() {
if (!this.username || !this.password || !this.email) return;
const user = await $fetch('/api/signup', {
method: 'post', body: {
username: this.username,
email: this.email,
password: this.password
}
})
const userId = useCookie('userId')
userId.value = user.userId
const token = useCookie('sessionToken')
token.value = user.token
}
}
}
</script>