Fix late night errors

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2020-08-18 11:57:01 +02:00
parent d02a92e870
commit 135ceb4a9d
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
2 changed files with 6 additions and 1 deletions

View File

@ -107,7 +107,7 @@ class BackgroundService {
} }
public function setShippedBackground($fileName) { public function setShippedBackground($fileName) {
if (!in_array($fileName, self::SHIPPED_BACKGROUNDS)) { if (!array_key_exists($fileName, self::SHIPPED_BACKGROUNDS)) {
throw new \InvalidArgumentException('The given file name is invalid'); throw new \InvalidArgumentException('The given file name is invalid');
} }
$this->config->setUserValue($this->userId, 'dashboard', 'background', $fileName); $this->config->setUserValue($this->userId, 'dashboard', 'background', $fileName);

View File

@ -95,6 +95,11 @@ export default {
async update(data) { async update(data) {
const background = data.type === 'custom' || data.type === 'default' ? data.type : data.value const background = data.type === 'custom' || data.type === 'default' ? data.type : data.value
this.backgroundImage = getBackgroundUrl(background, data.version) this.backgroundImage = getBackgroundUrl(background, data.version)
if (data.type === 'color') {
this.$emit('updateBackground', data)
this.loading = false
return
}
const image = new Image() const image = new Image()
image.onload = () => { image.onload = () => {
this.$emit('updateBackground', data) this.$emit('updateBackground', data)