Finished settings page

This commit is contained in:
Leon Etienne (ubuntu wsl)
2020-10-02 18:09:51 +02:00
parent 5f7e4e2cf2
commit cb5f43bf25
53 changed files with 430 additions and 63 deletions

View File

@@ -0,0 +1,48 @@
import axios from 'axios';
export const state = () => ({
config: {}
});
export const mutations = {
updateGet(state, data) {
state.config = data;
},
};
export const actions = {
updateGet(context, callback) {
axios.post("/api", {
request: "update_config"
})
.then(function(response) {
if (response.data.status === "OK") {
context.commit("updateGet", response.data.config);
if (typeof(callback) === "function") callback();
}
});
},
updateSet(context, newConfig) {
axios.post("/api", {
request: "update_config",
config: newConfig
})
.then(function(response) {
if (response.data.status === "OK") {
// Also update the vuex store...
context.commit("updateGet", response.data.config);
}
});
},
resetToDefaults(context) {
axios.post("/api", {
request: "reset_config_to_default_values"
})
.then(function(response) {
if (response.data.status === "OK") {
// Also update the vuex store...
context.commit("updateGet", response.data.config);
}
});
}
};