fix(ui): DevIndexBadge и dev-код подтверждения скрыты в проде (гейт import.meta.env.DEV)

This commit is contained in:
Дмитрий
2026-06-21 12:26:54 +03:00
parent 8372cd497d
commit 8151a3955d
2 changed files with 8 additions and 2 deletions
@@ -1,5 +1,5 @@
<template>
<div v-if="index" class="dev-index-badge" :class="{ 'is-dialog': dialogMode }">
<div v-if="isDev && index" class="dev-index-badge" :class="{ 'is-dialog': dialogMode }">
<span class="dev-index-num">{{ index }}</span>
<span class="dev-index-label">{{ label }}</span>
</div>
@@ -22,6 +22,10 @@ defineProps<{
label?: string;
dialogMode?: boolean;
}>();
// Гейт окружения: бейдж рисуется ТОЛЬКО в dev. В прод-сборке import.meta.env.DEV
// = false → бейдж не виден независимо от того, передан ли index хардкодом.
const isDev = import.meta.env.DEV;
</script>
<style scoped>
@@ -40,7 +40,9 @@ onUnmounted(() => {
if (cooldownTimer) clearInterval(cooldownTimer);
});
const devCode = computed(() => auth.pendingDevCode);
// Код подтверждения показываем ТОЛЬКО в dev (в проде import.meta.env.DEV=false →
// null, даже если бэкенд по ошибке вернёт pendingDevCode).
const devCode = computed(() => (import.meta.env.DEV ? auth.pendingDevCode : null));
const canSubmit = computed(() => /^\d{6}$/.test(code.value) && email.value.length > 0);
async function handleConfirm() {