add API node type instead of always use string to define api node
This commit is contained in:
@ -6,7 +6,7 @@ import InfoHeaderItem from '../../elements/InfoHeaderItem/InfoHeaderItem';
|
||||
import {faArchive, faBalanceScaleLeft, faRulerVertical} from '@fortawesome/free-solid-svg-icons';
|
||||
import {faAddressCard} from '@fortawesome/free-regular-svg-icons';
|
||||
import {version} from '../../../package.json';
|
||||
import {callAPI, setCustomBackendDomain} from '../../utils/Api';
|
||||
import {APINode, callAPI, setCustomBackendDomain} from '../../utils/Api';
|
||||
import {SettingsTypes} from '../../types/ApiTypes';
|
||||
import {GeneralSuccess} from '../../types/GeneralTypes';
|
||||
|
||||
@ -191,7 +191,7 @@ class GeneralSettings extends React.Component<props, state> {
|
||||
* inital load of already specified settings from backend
|
||||
*/
|
||||
loadSettings(): void {
|
||||
callAPI('settings.php', {action: 'loadGeneralSettings'}, (result: SettingsTypes.loadGeneralSettingsType) => {
|
||||
callAPI(APINode.Settings, {action: 'loadGeneralSettings'}, (result: SettingsTypes.loadGeneralSettingsType) => {
|
||||
this.setState({
|
||||
videopath: result.video_path,
|
||||
tvshowpath: result.episode_path,
|
||||
@ -212,7 +212,7 @@ class GeneralSettings extends React.Component<props, state> {
|
||||
* save the selected and typed settings to the backend
|
||||
*/
|
||||
saveSettings(): void {
|
||||
callAPI('settings.php', {
|
||||
callAPI(APINode.Settings, {
|
||||
action: 'saveGeneralSettings',
|
||||
password: this.state.passwordsupport ? this.state.password : '-1',
|
||||
videopath: this.state.videopath,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import style from './MovieSettings.module.css';
|
||||
import {callAPI} from '../../utils/Api';
|
||||
import {APINode, callAPI} from '../../utils/Api';
|
||||
import {GeneralSuccess} from '../../types/GeneralTypes';
|
||||
import {SettingsTypes} from '../../types/ApiTypes';
|
||||
|
||||
@ -64,7 +64,7 @@ class MovieSettings extends React.Component<props, state> {
|
||||
|
||||
console.log('starting');
|
||||
|
||||
callAPI('settings.php', {action: 'startReindex'}, (result: GeneralSuccess): void => {
|
||||
callAPI(APINode.Settings, {action: 'startReindex'}, (result: GeneralSuccess): void => {
|
||||
console.log(result);
|
||||
if (result.result === 'success') {
|
||||
console.log('started successfully');
|
||||
@ -84,7 +84,7 @@ class MovieSettings extends React.Component<props, state> {
|
||||
* This interval function reloads the current status of reindexing from backend
|
||||
*/
|
||||
updateStatus = (): void => {
|
||||
callAPI('settings.php', {action: 'getStatusMessage'}, (result: SettingsTypes.getStatusMessageType) => {
|
||||
callAPI(APINode.Settings, {action: 'getStatusMessage'}, (result: SettingsTypes.getStatusMessageType) => {
|
||||
if (result.contentAvailable === true) {
|
||||
console.log(result);
|
||||
// todo 2020-07-4: scroll to bottom of div here
|
||||
@ -106,7 +106,7 @@ class MovieSettings extends React.Component<props, state> {
|
||||
* send request to cleanup db gravity
|
||||
*/
|
||||
cleanupGravity(): void {
|
||||
callAPI('settings.php', {action: 'cleanupGravity'}, (result) => {
|
||||
callAPI(APINode.Settings, {action: 'cleanupGravity'}, (result) => {
|
||||
this.setState({
|
||||
text: ['successfully cleaned up gravity!']
|
||||
});
|
||||
|
Reference in New Issue
Block a user