mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-01 15:19:36 +08:00
🐛 Fix(db): fix some db bugs
#873,#806
This commit is contained in:
@@ -72,6 +72,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'aliyun',
|
||||
mixins: [mixin]
|
||||
@@ -99,7 +100,7 @@ export default class extends Vue {
|
||||
this.$refs.aliyun.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.aliyun': this.form
|
||||
'picBed.aliyun': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new window.Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'github',
|
||||
mixins: [mixin]
|
||||
@@ -84,7 +85,7 @@ export default class extends Vue {
|
||||
this.$refs.github.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.github': this.form
|
||||
'picBed.github': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'imgur',
|
||||
mixins: [mixin]
|
||||
@@ -61,7 +62,7 @@ export default class extends Vue {
|
||||
this.$refs.imgur.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.imgur': this.form
|
||||
'picBed.imgur': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
ipcRenderer,
|
||||
IpcRendererEvent
|
||||
} from 'electron'
|
||||
import { trimValues } from '@/utils/common'
|
||||
|
||||
@Component({
|
||||
name: 'OtherPicBed',
|
||||
@@ -58,7 +59,7 @@ export default class extends Vue {
|
||||
const result = await this.$refs.configForm.validate()
|
||||
if (result !== false) {
|
||||
this.saveConfig({
|
||||
[`picBed.${this.type}`]: result
|
||||
[`picBed.${this.type}`]: trimValues(result)
|
||||
})
|
||||
const successNotification = new Notification(this.$T('SETTINGS_RESULT'), {
|
||||
body: this.$T('TIPS_SET_SUCCEED')
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'qiniu',
|
||||
mixins: [mixin]
|
||||
@@ -101,7 +102,7 @@ export default class extends Vue {
|
||||
this.$refs.qiniu.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.qiniu': this.form
|
||||
'picBed.qiniu': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'smms',
|
||||
mixins: [mixin]
|
||||
@@ -54,7 +55,7 @@ export default class extends Vue {
|
||||
this.$refs.smms.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.smms': this.form
|
||||
'picBed.smms': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new window.Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
||||
@@ -96,6 +96,7 @@ import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { OPEN_URL } from '#/events/constants'
|
||||
import { ITcyunConfig } from 'picgo/dist/types'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'tcyun',
|
||||
mixins: [mixin]
|
||||
@@ -125,7 +126,7 @@ export default class extends Vue {
|
||||
this.$refs.tcyun.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.tcyun': this.form
|
||||
'picBed.tcyun': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new window.Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import mixin from '@/utils/ConfirmButtonMixin'
|
||||
import { IUpyunConfig } from 'picgo/dist/types'
|
||||
import { trimValues } from '@/utils/common'
|
||||
@Component({
|
||||
name: 'upyun',
|
||||
mixins: [mixin]
|
||||
@@ -94,7 +95,7 @@ export default class extends Vue {
|
||||
this.$refs.tcyun.validate((valid) => {
|
||||
if (valid) {
|
||||
this.saveConfig({
|
||||
'picBed.upyun': this.form
|
||||
'picBed.upyun': trimValues(this.form)
|
||||
})
|
||||
const successNotification = new Notification('设置结果', {
|
||||
body: '设置成功'
|
||||
|
||||
@@ -8,3 +8,11 @@ export const handleTalkingDataEvent = (data: ITalkingDataOptions) => {
|
||||
console.log('talkingData', data)
|
||||
}
|
||||
}
|
||||
|
||||
export const trimValues = (obj: IStringKeyMap) => {
|
||||
const newObj = {} as IStringKeyMap
|
||||
Object.keys(obj).forEach(key => {
|
||||
newObj[key] = typeof obj[key] === 'string' ? obj[key].trim() : obj[key]
|
||||
})
|
||||
return newObj
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user