- Created backend structure with Go, including main application logic and API endpoints. - Added Docker support for both development and production environments. - Introduced frontend using Nuxt 3 with Tailwind CSS for styling. - Included configuration files for Docker and environment variables. - Established basic documentation for contributing, development, and deployment processes. - Set up .gitignore and .dockerignore files to manage ignored files in the repository.
57 lines
1.6 KiB
Vue
57 lines
1.6 KiB
Vue
<template>
|
|
<div class="min-h-screen flex flex-col items-center justify-center bg-base-200 p-4 overflow-hidden">
|
|
<div class="card w-full max-w-sm bg-base-100 shadow-xl">
|
|
<div class="card-body">
|
|
<h1 class="card-title justify-center">Log in</h1>
|
|
<form @submit.prevent="submit" class="flex flex-col gap-4">
|
|
<div class="form-control">
|
|
<label class="label" for="user">User</label>
|
|
<input
|
|
id="user"
|
|
v-model="user"
|
|
type="text"
|
|
class="input input-bordered"
|
|
required
|
|
autocomplete="username"
|
|
/>
|
|
</div>
|
|
<PasswordInput
|
|
v-model="pass"
|
|
label="Password"
|
|
required
|
|
autocomplete="current-password"
|
|
/>
|
|
<p v-if="error" class="text-error text-sm">{{ error }}</p>
|
|
<button type="submit" class="btn btn-primary" :disabled="loading">
|
|
{{ loading ? '…' : 'Log in' }}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
// No auth required; auth.global skips this path
|
|
|
|
const user = ref('')
|
|
const pass = ref('')
|
|
const error = ref('')
|
|
const loading = ref(false)
|
|
const router = useRouter()
|
|
const api = useMapApi()
|
|
|
|
async function submit() {
|
|
error.value = ''
|
|
loading.value = true
|
|
try {
|
|
await api.login(user.value, pass.value)
|
|
await router.push('/profile')
|
|
} catch (e: unknown) {
|
|
error.value = e instanceof Error ? e.message : 'Login failed'
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
</script>
|