Prechádzať zdrojové kódy

fix overseerr placement of api calls
fix loader on requests

CauseFX 4 rokov pred
rodič
commit
3d0c810c00
2 zmenil súbory, kde vykonal 13 pridanie a 10 odobranie
  1. 9 9
      api/v2/routes/homepage.php
  2. 4 1
      js/functions.js

+ 9 - 9
api/v2/routes/homepage.php

@@ -366,15 +366,6 @@ $app->get('/homepage/overseerr/requests[/{type}[/{limit}[/{offset}]]]', function
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')
 		->withStatus($GLOBALS['responseCode']);
 });
-$app->post('/homepage/overseerr/requests/{type}/{id}[/{seasons}]', function ($request, $response, $args) {
-	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
-	$args['seasons'] = $args['seasons'] ?? null;
-	$Organizr->addOverseerrRequest($args['id'], $args['type'], $args['seasons']);
-	$response->getBody()->write(jsonE($GLOBALS['api']));
-	return $response
-		->withHeader('Content-Type', 'application/json;charset=UTF-8')
-		->withStatus($GLOBALS['responseCode']);
-});
 $app->post('/homepage/overseerr/requests/{type}/{id}/available', function ($request, $response, $args) {
 	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
 	$Organizr->actionOverseerrRequest($args['id'], $args['type'], 'available');
@@ -423,6 +414,15 @@ $app->delete('/homepage/overseerr/requests/{type}/{id}', function ($request, $re
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')
 		->withStatus($GLOBALS['responseCode']);
 });
+$app->post('/homepage/overseerr/requests/{type}/{id}[/{seasons}]', function ($request, $response, $args) {
+	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
+	$args['seasons'] = $args['seasons'] ?? null;
+	$Organizr->addOverseerrRequest($args['id'], $args['type'], $args['seasons']);
+	$response->getBody()->write(jsonE($GLOBALS['api']));
+	return $response
+		->withHeader('Content-Type', 'application/json;charset=UTF-8')
+		->withStatus($GLOBALS['responseCode']);
+});
 $app->get('/homepage/ombi/requests[/{type}[/{limit}[/{offset}]]]', function ($request, $response, $args) {
 	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
 	$args['type'] = $args['type'] ?? 'both';

+ 4 - 1
js/functions.js

@@ -5778,11 +5778,14 @@ function overseerrActions(id, action, type = null, extra = null){
 			let response = data.response;
 			if(action == 'add'){
 				addTempRequest();
+				setTimeout(function(){
+						ajaxloader();
+					}, 2000
+				);
 			}
 			messageSingle(response.message,'',activeInfo.settings.notifications.position,"#FFF","success","5000");
 			homepageRequests('overseerr');
 			cleanCloseSwal();
-			ajaxloader();
 		}catch(e) {
 			organizrCatchError(e,data);
 		}