♻️ (account) set account id in store when public
This commit is contained in:
@@ -181,6 +181,7 @@ import IStat from '@/models/IStat'
|
|||||||
import ITransaction from '@/models/ITransaction'
|
import ITransaction from '@/models/ITransaction'
|
||||||
import IUser from '@/models/IUser'
|
import IUser from '@/models/IUser'
|
||||||
import { primary, main, findContrastColor, findDarkValue } from '@/utils'
|
import { primary, main, findContrastColor, findDarkValue } from '@/utils'
|
||||||
|
import couchService from '@/services/CouchService'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
@@ -199,6 +200,8 @@ import { primary, main, findContrastColor, findDarkValue } from '@/utils'
|
|||||||
export default class AccountItem extends BaseAccount {
|
export default class AccountItem extends BaseAccount {
|
||||||
@Action
|
@Action
|
||||||
public setTitle!: any
|
public setTitle!: any
|
||||||
|
@Action
|
||||||
|
public addAccountId!: any
|
||||||
public retrieveTransactions: boolean = false
|
public retrieveTransactions: boolean = false
|
||||||
public transactions: ITransaction[] = []
|
public transactions: ITransaction[] = []
|
||||||
public activeTab: string = 'transaction'
|
public activeTab: string = 'transaction'
|
||||||
@@ -216,6 +219,11 @@ export default class AccountItem extends BaseAccount {
|
|||||||
this.$router.push({ name: 'home' })
|
this.$router.push({ name: 'home' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.account.isPublic) {
|
||||||
|
this.addAccountId({ accountId: this.id })
|
||||||
|
couchService.initLive()
|
||||||
|
}
|
||||||
this.transactions = await transactionService.getAllByAccountId(this.id)
|
this.transactions = await transactionService.getAllByAccountId(this.id)
|
||||||
this.retrieveTransactions = true
|
this.retrieveTransactions = true
|
||||||
if (document && document.documentElement) {
|
if (document && document.documentElement) {
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ import accountService from '@/services/AccountService'
|
|||||||
import queueNotifService from '@/services/QueueNotifService'
|
import queueNotifService from '@/services/QueueNotifService'
|
||||||
import IUser from '@/models/IUser'
|
import IUser from '@/models/IUser'
|
||||||
import { slug } from '@/utils'
|
import { slug } from '@/utils'
|
||||||
import couchService from '@/services/CouchService'
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
@@ -143,8 +142,6 @@ import couchService from '@/services/CouchService'
|
|||||||
export default class AccountNew extends Vue {
|
export default class AccountNew extends Vue {
|
||||||
@Getter
|
@Getter
|
||||||
public user!: IUser | null
|
public user!: IUser | null
|
||||||
@Action
|
|
||||||
public addAccountId!: any
|
|
||||||
public name: string = ''
|
public name: string = ''
|
||||||
public currencies: ICurrency[] = currencies
|
public currencies: ICurrency[] = currencies
|
||||||
public mainCurrency: ICurrency = currencies[0]
|
public mainCurrency: ICurrency = currencies[0]
|
||||||
@@ -231,10 +228,6 @@ export default class AccountNew extends Vue {
|
|||||||
isPublic: this.isPublic
|
isPublic: this.isPublic
|
||||||
}
|
}
|
||||||
const response: PouchDB.Core.Response = await accountService.add(newAccount)
|
const response: PouchDB.Core.Response = await accountService.add(newAccount)
|
||||||
if (newAccount.isPublic) {
|
|
||||||
this.addAccountId({ accountId: response.id })
|
|
||||||
couchService.initLive()
|
|
||||||
}
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
this.$router.push({ name: 'account', params: { id: response.id } })
|
this.$router.push({ name: 'account', params: { id: response.id } })
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user