mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-18 21:35:51 -04:00
New: Use ASP.NET Core instead of Nancy
This commit is contained in:
@@ -78,7 +78,9 @@ export default {
|
||||
const promise = createAjaxRequest({
|
||||
method: 'PUT',
|
||||
url: '/qualityDefinition/update',
|
||||
data: JSON.stringify(upatedDefinitions)
|
||||
data: JSON.stringify(upatedDefinitions),
|
||||
contentType: 'application/json',
|
||||
dataType: 'json'
|
||||
}).request;
|
||||
|
||||
promise.done((data) => {
|
||||
|
||||
@@ -123,6 +123,7 @@ export const actionHandlers = handleThunks({
|
||||
const promise = createAjaxRequest({
|
||||
url: '/movie',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(newMovie)
|
||||
}).request;
|
||||
|
||||
@@ -160,6 +160,7 @@ export const actionHandlers = handleThunks({
|
||||
url: '/blocklist/bulk',
|
||||
method: 'DELETE',
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({ ids })
|
||||
}).request;
|
||||
|
||||
|
||||
@@ -139,7 +139,8 @@ export function executeCommandHelper( payload, dispatch) {
|
||||
const promise = createAjaxRequest({
|
||||
url: '/command',
|
||||
method: 'POST',
|
||||
data: JSON.stringify(payload)
|
||||
data: JSON.stringify(payload),
|
||||
dataType: 'json'
|
||||
}).request;
|
||||
|
||||
return promise.then((data) => {
|
||||
|
||||
@@ -78,7 +78,8 @@ export const actionHandlers = handleThunks({
|
||||
|
||||
const promise = createAjaxRequest({
|
||||
url: `/history/failed/${historyId}`,
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
dataType: 'json'
|
||||
}).request;
|
||||
|
||||
promise.done(() => {
|
||||
@@ -97,4 +98,3 @@ export const reducers = createHandleActions({
|
||||
}
|
||||
|
||||
}, defaultState, section);
|
||||
|
||||
|
||||
@@ -396,6 +396,7 @@ export const actionHandlers = handleThunks({
|
||||
url: `/queue/bulk?removeFromClient=${remove}&blocklist=${blocklist}`,
|
||||
method: 'DELETE',
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({ ids })
|
||||
}).request;
|
||||
|
||||
@@ -453,4 +454,3 @@ export const reducers = createHandleActions({
|
||||
})
|
||||
|
||||
}, defaultState, section);
|
||||
|
||||
|
||||
@@ -240,6 +240,7 @@ export const actionHandlers = handleThunks({
|
||||
const promise = createAjaxRequest({
|
||||
url: '/release',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(payload)
|
||||
}).request;
|
||||
|
||||
@@ -53,7 +53,8 @@ export const actionHandlers = handleThunks({
|
||||
const promise = createAjaxRequest({
|
||||
url: '/tag',
|
||||
method: 'POST',
|
||||
data: JSON.stringify(payload.tag)
|
||||
data: JSON.stringify(payload.tag),
|
||||
dataType: 'json'
|
||||
}).request;
|
||||
|
||||
promise.done((data) => {
|
||||
|
||||
@@ -7,18 +7,6 @@ function isRelative(ajaxOptions) {
|
||||
return !absUrlRegex.test(ajaxOptions.url);
|
||||
}
|
||||
|
||||
function moveBodyToQuery(ajaxOptions) {
|
||||
if (ajaxOptions.data && ajaxOptions.type === 'DELETE') {
|
||||
if (ajaxOptions.url.contains('?')) {
|
||||
ajaxOptions.url += '&';
|
||||
} else {
|
||||
ajaxOptions.url += '?';
|
||||
}
|
||||
ajaxOptions.url += $.param(ajaxOptions.data);
|
||||
delete ajaxOptions.data;
|
||||
}
|
||||
}
|
||||
|
||||
function addRootUrl(ajaxOptions) {
|
||||
ajaxOptions.url = apiRoot + ajaxOptions.url;
|
||||
}
|
||||
@@ -32,7 +20,7 @@ function addContentType(ajaxOptions) {
|
||||
if (
|
||||
ajaxOptions.contentType == null &&
|
||||
ajaxOptions.dataType === 'json' &&
|
||||
(ajaxOptions.method === 'PUT' || ajaxOptions.method === 'POST')) {
|
||||
(ajaxOptions.method === 'PUT' || ajaxOptions.method === 'POST' || ajaxOptions.method === 'DELETE')) {
|
||||
ajaxOptions.contentType = 'application/json';
|
||||
}
|
||||
}
|
||||
@@ -49,10 +37,9 @@ export default function createAjaxRequest(originalAjaxOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
const ajaxOptions = { dataType: 'json', ...originalAjaxOptions };
|
||||
const ajaxOptions = { ...originalAjaxOptions };
|
||||
|
||||
if (isRelative(ajaxOptions)) {
|
||||
moveBodyToQuery(ajaxOptions);
|
||||
addRootUrl(ajaxOptions);
|
||||
addApiKey(ajaxOptions);
|
||||
addContentType(ajaxOptions);
|
||||
|
||||
Reference in New Issue
Block a user