Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AccountSettings.vue « views « src - github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5489cd9b2644880cde223bd543c711331ca1af25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<template>
  <AppContent app-name="mail">
    <template slot="navigation">
      <AppNavigationNew
        :text="t('mail', 'New message')"
        buttonId="mail_new_message"
        buttonClass="icon-add"
        @click="onNewMessage"
      />
      <ul id="accounts-list">
        <AppNavigationItem v-for="item in menu" :key="item.key" :item="item"/>
      </ul>
      <AppNavigationSettings :title="t('mail', 'Settings')">
        <AppSettingsMenu/>
      </AppNavigationSettings>
    </template>
    <template slot="content">
      <div class="section" id="account-info">
        <h2>{{ t ('mail', 'Account Settings') }} - {{ email }}</h2>
      </div>
      <div class="section">
        <div id="mail-settings">
          <AccountForm :displayName="displayName" :email="email" :save="onSave" :account="account"/>
        </div>
      </div>
    </template>
  </AppContent>
</template>

<script>
import {
	AppContent,
	AppNavigationItem,
	AppNavigationNew,
	AppNavigationSettings,
} from 'nextcloud-vue'
import AppSettingsMenu from '../components/AppSettingsMenu'
import AccountForm from '../components/AccountForm'

import SidebarItems from '../mixins/SidebarItems'

export default {
	name: 'AccountSettings',
	components: {
		AccountForm,
		AppContent,
		AppNavigationItem,
		AppNavigationNew,
		AppNavigationSettings,
		AppSettingsMenu,
	},
	extends: SidebarItems,
	computed: {
		menu() {
			return this.buildMenu()
		},
		account() {
			return this.$store.getters.getAccount(this.$route.params.accountId)
		},
		displayName() {
			return this.$store.getters.getAccount(this.$route.params.accountId)
				.name
		},
		email() {
			return this.$store.getters.getAccount(this.$route.params.accountId)
				.emailAddress
		},
	},
	methods: {
		onSave(data) {
			console.log('data to save:', data)
			return this.$store
				.dispatch('updateAccount', {
					...data,
					accountId: this.$route.params.accountId,
				})
				.then(account => account)
				.catch(err => {
					console.error('account update failed:', err)

					throw err
				})
		},
	},
}
</script>