diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 428843ac..4664ac4e 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -200,6 +200,14 @@ window.App.util = { clipboard: (function(data) { return navigator.clipboard.writeText(data); + }), + + navatar: (function() { + $('#navbarDropdown .far').addClass('d-none'); + $('#navbarDropdown img').attr('src',window._sharedData.curUser.avatar) + .removeClass('d-none') + .addClass('rounded-circle border shadow') + .attr('width', 34).attr('height', 34); }) }; \ No newline at end of file diff --git a/resources/assets/js/components/Activity.vue b/resources/assets/js/components/Activity.vue index ff4d6cca..570a2e79 100644 --- a/resources/assets/js/components/Activity.vue +++ b/resources/assets/js/components/Activity.vue @@ -130,6 +130,10 @@ export default { methods: { fetchNotifications() { + axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { + window._sharedData.curUser = res.data; + window.App.util.navatar(); + }); axios.get('/api/pixelfed/v1/notifications', { params: { pg: true diff --git a/resources/assets/js/components/CollectionComponent.vue b/resources/assets/js/components/CollectionComponent.vue index 18d6ccf5..559f7447 100644 --- a/resources/assets/js/components/CollectionComponent.vue +++ b/resources/assets/js/components/CollectionComponent.vue @@ -191,6 +191,8 @@ export default { axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { this.currentUser = res.data; this.owner = this.currentUser.id == this.profileId; + window._sharedData.curUser = res.data; + window.App.util.navatar(); }); } }, diff --git a/resources/assets/js/components/CollectionCompose.vue b/resources/assets/js/components/CollectionCompose.vue index cf7b5068..e6556af7 100644 --- a/resources/assets/js/components/CollectionCompose.vue +++ b/resources/assets/js/components/CollectionCompose.vue @@ -145,6 +145,10 @@ export default { mounted() { this.fetchRecentPosts(); this.fetchItems(); + axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { + window._sharedData.curUser = res.data; + window.App.util.navatar(); + }); }, methods: { addToIds(id) { diff --git a/resources/assets/js/components/Direct.vue b/resources/assets/js/components/Direct.vue index 5682a7b6..b9093dab 100644 --- a/resources/assets/js/components/Direct.vue +++ b/resources/assets/js/components/Direct.vue @@ -246,6 +246,7 @@ export default { axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { this.profile = res.data; window._sharedData.curUser = res.data; + window.App.util.navatar(); }); }, diff --git a/resources/assets/js/components/DirectMessage.vue b/resources/assets/js/components/DirectMessage.vue index 6b1b825e..1d4dbe87 100644 --- a/resources/assets/js/components/DirectMessage.vue +++ b/resources/assets/js/components/DirectMessage.vue @@ -433,6 +433,7 @@ axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { this.profile = res.data; window._sharedData.curUser = res.data; + window.App.util.navatar(); }); }, diff --git a/resources/assets/js/components/DiscoverComponent.vue b/resources/assets/js/components/DiscoverComponent.vue index 51bab70a..6ad5cd53 100644 --- a/resources/assets/js/components/DiscoverComponent.vue +++ b/resources/assets/js/components/DiscoverComponent.vue @@ -252,6 +252,10 @@ this.posts = res.data.posts; this.loaded = true; }); + axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { + window._sharedData.curUser = res.data; + window.App.util.navatar(); + }); }, fetchCategories() { diff --git a/resources/assets/js/components/Hashtag.vue b/resources/assets/js/components/Hashtag.vue index e737859b..53d97fd4 100644 --- a/resources/assets/js/components/Hashtag.vue +++ b/resources/assets/js/components/Hashtag.vue @@ -123,6 +123,12 @@ }, methods: { getResults() { + if(this.authenticated) { + axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { + window._sharedData.curUser = res.data; + window.App.util.navatar(); + }); + } axios.get('/api/v2/discover/tag', { params: { hashtag: this.hashtag, diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index e12d0b56..c0091c46 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -841,6 +841,7 @@ export default { self.status = response.data.status; self.user = response.data.user; window._sharedData.curUser = self.user; + window.App.util.navatar(); self.media = self.status.media_attachments; self.reactions = response.data.reactions; self.likes = response.data.likes; diff --git a/resources/assets/js/components/Profile.vue b/resources/assets/js/components/Profile.vue index 9a86874f..fd65b5dc 100644 --- a/resources/assets/js/components/Profile.vue +++ b/resources/assets/js/components/Profile.vue @@ -705,6 +705,8 @@ if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == true) { axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { this.user = res.data; + window._sharedData.curUser = res.data; + window.App.util.navatar(); if(res.data.id == this.profileId || this.relationship.following == true) { axios.get('/api/stories/v0/exists/' + this.profileId) .then(res => { diff --git a/resources/assets/js/components/RemotePost.vue b/resources/assets/js/components/RemotePost.vue index 63883c7c..c85dcaf2 100644 --- a/resources/assets/js/components/RemotePost.vue +++ b/resources/assets/js/components/RemotePost.vue @@ -526,6 +526,10 @@ export default { }).catch(error => { swal('Oops!', 'An error occured, please try refreshing the page.', 'error'); }); + axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { + window._sharedData.curUser = res.data; + window.App.util.navatar(); + }); }, likesModal() { diff --git a/resources/assets/js/components/RemoteProfile.vue b/resources/assets/js/components/RemoteProfile.vue index 95de97b4..4c98abc4 100644 --- a/resources/assets/js/components/RemoteProfile.vue +++ b/resources/assets/js/components/RemoteProfile.vue @@ -220,6 +220,8 @@ fetchProfile() { axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { this.user = res.data + window._sharedData.curUser = res.data; + window.App.util.navatar(); }); axios.get('/api/pixelfed/v1/accounts/' + this.profileId) .then(res => { diff --git a/resources/assets/js/components/SearchResults.vue b/resources/assets/js/components/SearchResults.vue index 98c55667..5fff1979 100644 --- a/resources/assets/js/components/SearchResults.vue +++ b/resources/assets/js/components/SearchResults.vue @@ -361,6 +361,10 @@ export default { let lexer = this.searchLexer(); this.analysis = lexer; this.fetchSearchResults(); + axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { + window._sharedData.curUser = res.data; + window.App.util.navatar(); + }); }, fetchSearchResults() { diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index 7b6e219b..803c5c96 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -781,6 +781,7 @@ this.modes.mod = true; } window._sharedData.curUser = res.data; + window.App.util.navatar(); this.hasStory(); // this.expRec(); }).catch(err => { diff --git a/resources/views/layouts/partial/nav.blade.php b/resources/views/layouts/partial/nav.blade.php index 21685252..6dca08e3 100644 --- a/resources/views/layouts/partial/nav.blade.php +++ b/resources/views/layouts/partial/nav.blade.php @@ -31,7 +31,7 @@ @endif @else