pleroma-fe/src/components/settings_modal/tabs/profile_tab.js

59 lines
1.4 KiB
JavaScript
Raw Normal View History

2025-08-03 21:56:45 +03:00
import UserCard from 'src/components/user_card/user_card.vue'
import Checkbox from 'src/components/checkbox/checkbox.vue'
import BooleanSetting from '../helpers/boolean_setting.vue'
import SharedComputedObject from '../helpers/shared_computed_object.js'
2025-08-04 13:48:09 +03:00
import ProfileSettingIndicator from '../helpers/profile_setting_indicator.vue'
2020-10-20 21:18:23 +03:00
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faTimes,
2020-10-21 00:01:28 +03:00
faPlus,
2026-01-06 16:22:52 +02:00
faCircleNotch,
2020-10-20 21:18:23 +03:00
} from '@fortawesome/free-solid-svg-icons'
2026-01-06 16:22:52 +02:00
library.add(faTimes, faPlus, faCircleNotch)
2020-05-03 17:36:12 +03:00
const ProfileTab = {
2026-01-06 16:22:52 +02:00
data() {
2020-05-03 17:36:12 +03:00
return {
2025-08-05 17:08:33 +03:00
// Whether user is locked or not
2025-08-04 13:48:09 +03:00
locked: this.$store.state.users.currentUser.locked,
2020-05-03 17:36:12 +03:00
}
},
components: {
2025-08-03 21:56:45 +03:00
UserCard,
Checkbox,
BooleanSetting,
2026-01-06 16:22:52 +02:00
ProfileSettingIndicator,
2020-05-03 17:36:12 +03:00
},
computed: {
2026-01-06 16:22:52 +02:00
user() {
2020-05-03 17:36:12 +03:00
return this.$store.state.users.currentUser
},
2026-01-06 16:22:52 +02:00
...SharedComputedObject(),
2020-05-03 17:36:12 +03:00
},
methods: {
2026-01-06 16:22:52 +02:00
updateProfile() {
2025-08-04 13:48:09 +03:00
const params = {
2026-01-06 16:22:52 +02:00
locked: this.locked,
2025-08-04 13:48:09 +03:00
}
this.$store.state.api.backendInteractor
.updateProfile({ params })
.then((user) => {
this.$store.commit('addNewUsers', [user])
this.$store.commit('setCurrentUser', user)
})
.catch((error) => {
this.displayUploadError(error)
})
2026-01-06 16:22:52 +02:00
},
2025-08-04 13:48:09 +03:00
},
watch: {
2026-01-06 16:22:52 +02:00
locked() {
2025-08-04 13:48:09 +03:00
this.updateProfile()
2026-01-06 16:22:52 +02:00
},
},
2020-05-03 17:36:12 +03:00
}
export default ProfileTab