{"version":3,"file":"Login-AllcMWAQ.js","sources":["../../src/views/auth/Login.vue"],"sourcesContent":["<template>\n  <div class=\"flex flex-col items-center justify-center min-h-screen md:bg-gray-100\">\n    <div class=\"px-8 py-6 mt-4 bg-white rounded-lg border-gray-300 md:shadow-lg md:border\">\n      <div class=\"flex justify-center mb-4\">\n        <img src=\"../../assets/logo.png\" alt=\"logo\" class=\"h-32 w-auto\" />\n      </div>\n      <h3 class=\"text-2xl text-gray-700 font-bold text-center\">Login to your account</h3>\n      <div class=\"w-full h-12 flex items-center justify-center\">\n        <span v-if=\"error\" class=\"text-red-600 text-center\">{{ error }}</span>\n      </div>\n      <form @submit.prevent=\"login\">\n        <div>\n          <label class=\"block text-gray-700\" for=\"email\">Email</label>\n          <input\n            v-model=\"email\"\n            type=\"text\"\n            placeholder=\"Email\"\n            class=\"w-full px-4 py-2 mt-2 border border-gray-400 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-600\"\n          />\n        </div>\n        <div class=\"mt-4\">\n          <label class=\"block text-gray-700\">Password</label>\n          <input\n            v-model=\"password\"\n            type=\"password\"\n            placeholder=\"Password\"\n            class=\"w-full px-4 py-2 mt-2 border border-gray-400 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-600\"\n          />\n        </div>\n        <div class=\"flex items-baseline justify-between mt-4\">\n          <Button type=\"submit\">Login</Button>\n          <router-link :to=\"{ name: 'auth-reset-password' }\" class=\"text-sm text-blue-600 hover:underline\"\n            >Forgot password?</router-link\n          >\n        </div>\n      </form>\n    </div>\n    <div class=\"mt-4\">\n      <span>Don't have an account?</span>\n      <router-link :to=\"{ name: 'auth-register' }\" class=\"ml-2 text-blue-600 hover:underline\">Create one</router-link>\n    </div>\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { useRouter } from 'vue-router';\nimport Button from 'primevue/button';\nimport { ClientResponseError } from 'pocketbase';\nimport { useAuthStore } from '~/compositions/useAuthStore';\n\nconst router = useRouter();\nconst authStore = useAuthStore();\n\nconst email = ref('');\nconst password = ref('');\nconst error = ref<string>();\n\nasync function login() {\n  error.value = '';\n\n  try {\n    await authStore.login(email.value, password.value);\n  } catch (e) {\n    const _error = e as ClientResponseError;\n    error.value = _error.message;\n    email.value = '';\n    password.value = '';\n    return;\n  }\n\n  if (authStore.redirectAfterLoginUrl) {\n    await router.push(authStore.redirectAfterLoginUrl);\n    return;\n  }\n\n  await router.push({ name: 'home' });\n}\n</script>\n"],"names":["router","useRouter","authStore","useAuthStore","email","ref","password","error","login","e","_error"],"mappings":"osBAmDA,MAAMA,EAASC,IACTC,EAAYC,IAEZC,EAAQC,EAAI,EAAE,EACdC,EAAWD,EAAI,EAAE,EACjBE,EAAQF,IAEd,eAAeG,GAAQ,CACrBD,EAAM,MAAQ,GAEV,GAAA,CACF,MAAML,EAAU,MAAME,EAAM,MAAOE,EAAS,KAAK,QAC1CG,EAAG,CACV,MAAMC,EAASD,EACfF,EAAM,MAAQG,EAAO,QACrBN,EAAM,MAAQ,GACdE,EAAS,MAAQ,GACjB,MACF,CAEA,GAAIJ,EAAU,sBAAuB,CAC7B,MAAAF,EAAO,KAAKE,EAAU,qBAAqB,EACjD,MACF,CAEA,MAAMF,EAAO,KAAK,CAAE,KAAM,MAAQ,CAAA,CACpC"}