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

@@ -11,13 +11,13 @@ export const mutations = {
};
export const actions = {
update(context, instance) {
update(context) {
axios.post("/api", {
request: "get_disk_usage"
})
.then(function(response) {
if (response.data.status === "OK") {
instance.$store.commit("diskUsage/update", response.data.disk_usage);
context.commit("update", response.data.disk_usage);
}
});
},

View File

@@ -11,13 +11,13 @@ export const mutations = {
};
export const actions = {
update(context, instance) {
update(context) {
axios.post("/api", {
request: "fetch_alltime_cache"
})
.then(function(response) {
if (response.data.status === "OK") {
instance.$store.commit("dlcache/update", response.data.cache);
context.commit("update", response.data.cache);
}
});
},

View File

@@ -11,13 +11,13 @@ export const mutations = {
};
export const actions = {
update(context, instance) {
update(context) {
axios.post("/api", {
request: "fetch_session_logs"
})
.then(function(response) {
if (response.data.status === "OK") {
instance.$store.commit("logs/update", response.data.logs);
context.commit("update", response.data.logs);
}
});
},

View File

@@ -11,13 +11,13 @@ export const mutations = {
};
export const actions = {
update(context, instance) {
update(context) {
axios.post("/api", {
request: "get_os_name"
})
.then(function(response) {
if (response.data.status === "OK") {
instance.$store.commit("serverOs/update", response.data.os_name);
context.commit("update", response.data.os_name);
}
});
},

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);
}
});
}
};