Major cleanup and refactoring of the backend (frontend not fully updated).
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
|
||||
<script setup>
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { registerWithSession } from '@/utils/passkey'
|
||||
import { registerCredential } from '@/utils/passkey'
|
||||
import { ref, onMounted } from 'vue'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
@@ -25,9 +25,7 @@ const hasDeviceSession = ref(false)
|
||||
onMounted(async () => {
|
||||
try {
|
||||
// Check if we have a device addition session
|
||||
const response = await fetch('/auth/device-session-check', {
|
||||
credentials: 'include'
|
||||
})
|
||||
const response = await fetch('/auth/device-session-check')
|
||||
const data = await response.json()
|
||||
|
||||
if (data.device_addition_session) {
|
||||
@@ -50,7 +48,7 @@ function register() {
|
||||
|
||||
authStore.isLoading = true
|
||||
authStore.showMessage('Starting registration...', 'info')
|
||||
registerWithSession().finally(() => {
|
||||
registerCredential().finally(() => {
|
||||
authStore.isLoading = false
|
||||
}).then(() => {
|
||||
authStore.showMessage('Passkey registered successfully!', 'success', 2000)
|
||||
|
||||
@@ -46,7 +46,7 @@ const copyLink = async (event) => {
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const response = await fetch('/auth/create-device-link', { method: 'POST' })
|
||||
const response = await fetch('/auth/create-link', { method: 'POST' })
|
||||
const result = await response.json()
|
||||
if (result.error) throw new Error(result.error)
|
||||
|
||||
@@ -63,7 +63,7 @@ onMounted(async () => {
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch device link:', error)
|
||||
console.error('Failed to create link:', error)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user