fix: trace debug — show Stranger_NNN for unnamed traces instead of unknown
This commit is contained in:
@@ -54,9 +54,9 @@
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<!-- API Demo -->
|
||||
<div class="mt-8 pt-6 border-t border-gray-700">
|
||||
<h3 class="text-sm font-medium text-gray-400 mb-3">API 範例</h3>
|
||||
<!-- API Demo (dev mode only) -->
|
||||
<div v-if="showApiExamples" class="mt-8 pt-6 border-t border-gray-700">
|
||||
<h3 class="text-sm font-medium text-gray-400 mb-3">API 範例 <span class="text-xs text-yellow-500">(dev)</span></h3>
|
||||
<div class="space-y-2 text-xs font-mono">
|
||||
<div class="bg-gray-900 p-2 rounded">
|
||||
<span class="text-green-400"># Login</span>
|
||||
@@ -76,18 +76,26 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { httpFetch, getCurrentConfig, saveConfig } from '@/api/client'
|
||||
|
||||
const username = ref('')
|
||||
const password = ref('')
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const username = ref(route.query.username as string || '')
|
||||
const password = ref(route.query.password as string || '')
|
||||
const error = ref('')
|
||||
const loading = ref(false)
|
||||
const showPassword = ref(false)
|
||||
const router = useRouter()
|
||||
|
||||
const baseUrl = computed(() => getCurrentConfig().api_base_url)
|
||||
const showApiExamples = ref(localStorage.getItem('devMode') === 'true')
|
||||
|
||||
onMounted(() => {
|
||||
if (username.value && password.value) {
|
||||
handleLogin()
|
||||
}
|
||||
})
|
||||
|
||||
const handleLogin = async () => {
|
||||
error.value = ''
|
||||
@@ -109,7 +117,8 @@ const handleLogin = async () => {
|
||||
localStorage.setItem('momentry_user', JSON.stringify(data.user))
|
||||
localStorage.setItem('momentry_api_key', data.api_key)
|
||||
saveConfig({ ...config, api_key: data.api_key })
|
||||
router.push('/home')
|
||||
const redirect = (route.query.redirect as string) || '/home'
|
||||
router.push(redirect)
|
||||
} else {
|
||||
error.value = data.message || 'Login failed'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user