🏗 Wiring up Settings form

This commit is contained in:
2021-11-15 21:27:04 -08:00
parent 305c172be7
commit b34c985ff4
6 changed files with 201 additions and 76 deletions

View File

@@ -1,13 +1,31 @@
import axios from "axios";
import { IExtractionOptions } from "threetwo-ui-typings";
import {} from "../constants/action-types";
import { SETTINGS_OBJECT_FETCHED } from "../constants/action-types";
import { SETTINGS_SERVICE_BASE_URI } from "../constants/endpoints";
export const saveSettings = (settingsObject) => async (dispatch) => {
export const saveSettings =
(settingsObject, airdcppUserSettings) => async (dispatch) => {
const result = await axios({
url: `${SETTINGS_SERVICE_BASE_URI}/saveSettings`,
method: "POST",
data: { settingsObject, airdcppUserSettings },
});
dispatch({
type: SETTINGS_OBJECT_FETCHED,
data: result.data,
});
};
export const getSettings = (settingsKey?) => async (dispatch) => {
const result = await axios({
url: `${SETTINGS_SERVICE_BASE_URI}/saveSettings`,
url: `${SETTINGS_SERVICE_BASE_URI}/getSettings`,
method: "POST",
data: settingsObject,
data: settingsKey,
});
console.log(result);
{
dispatch({
type: SETTINGS_OBJECT_FETCHED,
data: result.data,
});
}
};