Compare commits

..

No commits in common. '52760dd2a89b278000f0c7f07c5f354793bae767' and '43a5704043257cc5f39a42283b2087e8dcaa9ae0' have entirely different histories.

@ -1,61 +1,60 @@
// https://nuxt.com/docs/api/configuration/nuxt-config // https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [
'@nuxtjs/supabase', '@nuxtjs/supabase',
'@nuxtjs/tailwindcss', '@nuxtjs/tailwindcss',
'nuxt-icon', 'nuxt-icon',
'@pinia/nuxt', '@pinia/nuxt',
'@vueuse/nuxt', '@vueuse/nuxt',
'@nuxt/devtools', '@nuxt/devtools',
], ],
app: { app: {
pageTransition: false, pageTransition: false,
layoutTransition: false, layoutTransition: false,
}, },
alias: { alias: {
'@logo': '/assets/logo', '@logo': '/assets/logo',
'@assets': '/assets', '@assets': '/assets',
'@stores': '/stores', '@stores': '/stores',
}, },
tailwindcss: { tailwindcss: {
config: { config: {
content: [], content: [],
important: false, important: false,
theme: { theme: {
extend: { extend: {
colors: { colors: {
primary: '#0c0c0d', primary: '#0c0c0d',
secondary: '#18181b', secondary: '#18181b',
darkgray: '#121213', darkgray: '#121213',
lightgray: '#27272a', lightgray: '#27272a',
}, },
}, },
// uncomment when syntax highlight // uncomment when syntax highlight
// is enable for markdown (highlight.js) // is enable for markdown (highlight.js)
// typography: { // typography: {
// default: { // default: {
// css: { // css: {
// 'pre': null, // 'pre': null,
// 'code': null, // 'code': null,
// 'code::before': null, // 'code::before': null,
// 'code::after': null, // 'code::after': null,
// 'pre code': null, // 'pre code': null,
// 'pre code::before': null, // 'pre code::before': null,
// 'pre code::after': null, // 'pre code::after': null,
// }, // },
// }, // },
// }, // },
}, },
plugins: [require('@tailwindcss/typography')], plugins: [require('@tailwindcss/typography')],
}, },
}, },
typescript: { typescript: {
strict: true, strict: true,
}, },
supabase: { supabase: {
url: process.env.SUPABASE_URL, url: process.env.SUPABASE_URL,
key: process.env.SUPABASE_KEY, key: process.env.SUPABASE_KEY,
serviceKey: process.env.SUPABASE_SERVICE_KEY, serviceKey: process.env.SUPABASE_SERVICE_KEY,
}, },
ssr: false,
}) })

@ -1,72 +1,88 @@
<template> <template>
<App> <App>
<Header /> <Header />
<div class="bg-secondary mx-auto mt-12 flex h-96 w-96 flex-col items-center justify-center gap-8 rounded-xl p-8"> <div
<div class="flex w-full flex-col gap-2"> class="bg-secondary mx-auto mt-12 flex h-96 w-96 flex-col items-center justify-center gap-8 rounded-xl p-8">
<label class="w-full text-[#b3b3b3]"> Email </label> <div class="flex w-full flex-col gap-2">
<input type="text" <label class="w-full text-[#b3b3b3]"> Email </label>
class="bg-lightgray border-lightgray h-12 w-full rounded-md border p-4 text-lg placeholder:text-[#4f4f4f] focus:outline-none active:outline-none" <input
v-model="credential.email" placeholder="username" /> type="text"
</div> class="bg-lightgray border-lightgray h-12 w-full rounded-md border p-4 text-lg placeholder:text-[#4f4f4f] focus:outline-none active:outline-none"
<div class="flex w-full flex-col gap-2"> v-model="credential.email"
<label class="w-full text-[#b3b3b3]"> Password </label> placeholder="username" />
<input type="password" </div>
class="bg-lightgray border-lightgray h-12 w-full rounded-md border p-4 text-lg placeholder:text-[#4f4f4f] focus:outline-none active:outline-none" <div class="flex w-full flex-col gap-2">
v-model="credential.password" placeholder="password" /> <label class="w-full text-[#b3b3b3]"> Password </label>
</div> <input
<p class="cursor-pointer text-blue-500 underline" @click="toggleSignup()"> type="password"
{{ class="bg-lightgray border-lightgray h-12 w-full rounded-md border p-4 text-lg placeholder:text-[#4f4f4f] focus:outline-none active:outline-none"
isSignup v-model="credential.password"
? 'Already have an account? Login' placeholder="password" />
: "Don't have an account? Sign up" </div>
}} <p
</p> class="cursor-pointer text-blue-500 underline"
<button class="w-fit rounded-lg bg-blue-500 py-4 px-8" v-on="isSignup @click="
? { click: () => signUp() } mode === 'login' ? (mode = 'signup') : (mode = 'login')
: { click: () => signIn() } ">
"> {{
{{ isSignup ? 'Sign Up' : 'Login' }} mode === 'login'
</button> ? "Don't have an account? Sign up"
</div> : 'Already have an account? Login'
</App> }}
</p>
<button
class="w-fit rounded-lg bg-blue-500 py-4 px-8"
v-on="
mode === 'login'
? { click: () => signIn($event) }
: { click: () => signUp($event) }
">
{{ mode === 'login' ? 'Login' : 'Sign Up' }}
</button>
</div>
</App>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
definePageMeta({ definePageMeta({
middleware: ['auth'], middleware: ['auth'],
}) })
const credential = reactive({ interface Credential {
email: '', email: string
password: '', password: string
}) }
const router = useRouter() type Mode = 'login' | 'signup'
const user = useSupabaseUser()
const isSignup = ref<Boolean>(false)
const toggleSignup = () => { const credential: Credential = reactive({
isSignup.value = !isSignup.value email: '',
} password: '',
})
const signUp = async () => { const router = useRouter()
const error = userSignUp(credential.email, credential.password) const supabase = useSupabaseAuthClient()
const user = useSupabaseUser()
const mode = ref<Mode>('login')
console.log('error', error) watch(
} () => user.value,
() => {
if (user.value) {
router.push('/notes')
}
}
)
const signIn = async () => { const signUp = async (event: Event) => {
const error = userSignIn(credential.email, credential.password) const error = userSignUp(credential.email, credential.password)
console.log('error', error) console.log('error', error)
} }
watch( const signIn = async (event: Event) => {
() => user.value, const error = userSignIn(credential.email, credential.password)
() => {
if (user.value) { console.log('error', error)
router.push('/notes') }
}
}
)
</script> </script>

Loading…
Cancel
Save