Return the promise.

This commit is contained in:
James Cole
2025-07-30 08:37:19 +02:00
parent a2d2b7edd3
commit 8b57f45963
3 changed files with 9 additions and 5 deletions

View File

@@ -39,7 +39,7 @@ export default () => ({
['@convert-to-native.window'](event){
this.convertToNative = event.detail;
this.accountList = [];
console.log('I heard that!');
console.log('I heard that! (dashboard/boxes)');
this.boxData = null;
this.loadBoxes();
}

View File

@@ -71,9 +71,10 @@ let index = function () {
return {
convertToNative: false,
saveNativeSettings(event) {
setVariable('convert_to_native', event.currentTarget.checked);
this.$dispatch('convert-to-native', event.currentTarget.checked);
console.log('saveNativeSettings + dispatch.');
setVariable('convert_to_native', event.currentTarget.checked).then(() => {
console.log('Set convert to native to: ', event.currentTarget.checked);
this.$dispatch('convert-to-native', event.currentTarget.checked);
});
},
init() {
Promise.all([getVariable('convert_to_native', false)]).then((values) => {

View File

@@ -35,8 +35,9 @@ export function setVariable(name, value = null) {
// post to user preferences (because why not):
let putter = new Put();
putter.put(name, value).then((response) => {
return putter.put(name, value).then((response) => {
console.log('set "'+name+'" to value: ', value);
return Promise.resolve(response);
}).catch((error) => {
console.error(error);
// preference does not exist (yet).
@@ -44,6 +45,8 @@ export function setVariable(name, value = null) {
let poster = (new Post);
poster.post(name, value).then((response) => {
console.log('POST "'+name+'" to value: ', value);
return Promise.resolve(response);
});
});
}