Default to channel id

This commit is contained in:
Jiiks 2018-08-12 20:31:30 +03:00
parent a1a63f2c35
commit 3b8126781d
2 changed files with 8 additions and 1 deletions

View File

@ -11,10 +11,11 @@
import Kvp from './kvp';
export default class SecureKvpSetting extends Kvp {
/**
* The value to use when the setting doesn't have a value.
*/
get defaultValue() {
return { key: 'Key', value: '**********' };
return { key: 'PlaceholderKey', value: '' };
}
}

View File

@ -23,6 +23,8 @@
<script>
import aes256 from 'aes256';
import { DiscordApi } from 'modules';
export default {
data() {
return {
@ -52,6 +54,10 @@
if (e.key !== 'Enter') return;
e.target.blur();
}
},
beforeMount() {
if (this.setting.value.key !== 'PlaceholderKey') return;
this.setting.value.key = DiscordApi.currentChannel.id || 'Key';
}
}
</script>