From 19d316221c1b1379c9a9c8a527a6180adc793fcc Mon Sep 17 00:00:00 2001
From: "p.belezov"
Date: Tue, 18 Jun 2024 15:47:48 +0800
Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=BF=D0=B8=D0=BB=D0=B8=D0=B2?=
=?UTF-8?q?=D0=B0=D0=B5=D0=BC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
resources/views/Main.vue | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/resources/views/Main.vue b/resources/views/Main.vue
index 55ce07f..576b0a4 100644
--- a/resources/views/Main.vue
+++ b/resources/views/Main.vue
@@ -3,10 +3,14 @@
Вставьте ссылку:
-
-
- Найти
- Скачать
+
+
+
+ {{ hint }}
+
+ Найти
+ Скачать
+
@@ -21,14 +25,31 @@ export default {
name: "Main",
data: () => ({
url: ref(''),
- fetching: ref(false)
+ fetching: ref(false),
+ downloadAvailable: ref(false),
+ downloadLink: '',
+ hint: ref(''),
+ error: ref(false)
}),
methods: {
startDownload(){
+ this.error = false;
this.fetching = true;
axios.get(`/download_api?videourl=${this.url}`).then((responce)=>{
this.fetching = false;
- console.log(responce);
+ if (responce.data.error){
+ this.error = true;
+ this.hint = 'Возникла ошибка';
+ console.log(responce.data.error);
+ } else if (responce.data.link){
+ this.downloadAvailable = true;
+ this.downloadLink = `/download/${responce.data.link}`;
+ }
+ }).catch((error)=>{
+ this.fetching = false;
+ console.log(error);
+ this.error = true;
+ this.hint = 'Возникла ошибка';
})
}
}