Перенес запросы в api
This commit is contained in:
		
							parent
							
								
									65a1ea5a07
								
							
						
					
					
						commit
						ad921d10a1
					
				|  | @ -46,7 +46,7 @@ export default { | ||||||
|             this.downloadAvailable = false; |             this.downloadAvailable = false; | ||||||
|             this.error = false; |             this.error = false; | ||||||
|             this.fetching = true; |             this.fetching = true; | ||||||
|             axios.get(`/download_api?videourl=${this.url}`).then((responce)=>{ |             axios.get(`/api/v1/video/download?videourl=${this.url}`).then((responce)=>{ | ||||||
|                 this.fetching = false; |                 this.fetching = false; | ||||||
|                 if (responce.data.error){ |                 if (responce.data.error){ | ||||||
|                     this.error = true; |                     this.error = true; | ||||||
|  | @ -55,7 +55,7 @@ export default { | ||||||
|                     console.log(responce.data.error); |                     console.log(responce.data.error); | ||||||
|                 } else if (responce.data.link){ |                 } else if (responce.data.link){ | ||||||
|                     this.downloadAvailable = true; |                     this.downloadAvailable = true; | ||||||
|                     this.downloadLink = `/download/${responce.data.link}`; |                     this.downloadLink = `/api/v1/file/download/${responce.data.link}`; | ||||||
|                 } |                 } | ||||||
|             }).catch((error)=>{ |             }).catch((error)=>{ | ||||||
|                 this.fetching = false; |                 this.fetching = false; | ||||||
|  |  | ||||||
|  | @ -17,3 +17,12 @@ | ||||||
| Route::middleware('auth:sanctum')->get('/user', function (Request $request) { | Route::middleware('auth:sanctum')->get('/user', function (Request $request) { | ||||||
|     return $request->user(); |     return $request->user(); | ||||||
| }); | }); | ||||||
|  | 
 | ||||||
|  | Route::group(['prefix' => 'v1'], function () { | ||||||
|  |     Route::group(['prefix' => 'video'], function () { | ||||||
|  |         Route::get('/download', 'App\Http\Controllers\YoutubeDownloadController@index'); | ||||||
|  |     }); | ||||||
|  |     Route::group(['prefix' => 'file'], function () { | ||||||
|  |         Route::get('/download/{file}', 'App\Http\Controllers\DownloadController@download')->name('download'); | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | @ -16,6 +16,3 @@ | ||||||
| Route::get('/', function () { | Route::get('/', function () { | ||||||
|     return view('welcome'); |     return view('welcome'); | ||||||
| }); | }); | ||||||
| 
 |  | ||||||
| Route::get('/download_api', 'App\Http\Controllers\YoutubeDownloadController@index'); |  | ||||||
| Route::get('/download/{file}', 'App\Http\Controllers\DownloadController@download')->name('download'); |  | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue