feat: первое подключение фронтенда
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 8s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 54s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 27s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 6s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 8s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 54s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 27s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 6s
This commit is contained in:
@@ -2,16 +2,34 @@
|
||||
import { ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import GlassCard from '@/components/ui/GlassCard.vue'
|
||||
import { reviewsApi } from '@/api'
|
||||
|
||||
const route = useRoute()
|
||||
const rating = ref<'positive' | 'neutral' | 'negative'>('positive')
|
||||
const text = ref('Лекция была хорошо структурирована, особенно понравились практические примеры и разбор кейсов.')
|
||||
const submitted = ref(false)
|
||||
const editing = ref(false)
|
||||
const loading = ref(false)
|
||||
const error = ref('')
|
||||
|
||||
function submit() {
|
||||
submitted.value = true
|
||||
editing.value = false
|
||||
const ratingMap = {
|
||||
positive: 'Like',
|
||||
neutral: 'Neutral',
|
||||
negative: 'Dislike',
|
||||
} as const
|
||||
|
||||
async function submit() {
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
try {
|
||||
await reviewsApi.create(String(route.params.id), ratingMap[rating.value], text.value)
|
||||
submitted.value = true
|
||||
editing.value = false
|
||||
} catch (err) {
|
||||
error.value = err instanceof Error ? err.message : 'Не удалось отправить отзыв.'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -48,9 +66,10 @@ function submit() {
|
||||
<div class="hint">
|
||||
💡 Постарайтесь быть конкретными: что понравилось, где было сложно, какие темы хотите раскрыть глубже.
|
||||
</div>
|
||||
<div class="error" v-if="error">{{ error }}</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="btn-primary" type="submit">Отправить отзыв</button>
|
||||
<button class="btn-primary" type="submit" :disabled="loading">{{ loading ? 'Отправляем...' : 'Отправить отзыв' }}</button>
|
||||
<button class="btn-secondary" type="button" :disabled="submitted">Сохранить черновик</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -91,4 +110,5 @@ textarea {
|
||||
.success-icon { font-size: 28px; }
|
||||
.success-title { font-size: 16px; font-weight: 700; }
|
||||
.success-sub { font-size: 13px; color: var(--color-text-secondary); }
|
||||
.error { color: var(--color-error); font-size: 13px; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user