diff --git a/src/components/who_to_follow_panel/who_to_follow_panel.js b/src/components/who_to_follow_panel/who_to_follow_panel.js index b87004e44..0f7f93556 100644 --- a/src/components/who_to_follow_panel/who_to_follow_panel.js +++ b/src/components/who_to_follow_panel/who_to_follow_panel.js @@ -30,8 +30,8 @@ function showWhoToFollow(panel, reply) { }) } -function getWhoToFollow(panel) { - const credentials = panel.$useUsersStore().currentUser.credentials +function getWhoToFollow() { + const credentials = useOAuthStore().token if (credentials) { panel.usersToFollow.forEach((toFollow) => { toFollow.name = 'Loading...' @@ -66,7 +66,7 @@ const WhoToFollowPanel = { watch: { user: function () { if (this.suggestionsEnabled) { - getWhoToFollow(this) + getWhoToFollow() } }, }, @@ -77,7 +77,7 @@ const WhoToFollowPanel = { id: 0, })) if (this.suggestionsEnabled) { - getWhoToFollow(this) + getWhoToFollow() } }, } diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js index 00b8699ac..4c8872ce9 100644 --- a/src/services/status_poster/status_poster.service.js +++ b/src/services/status_poster/status_poster.service.js @@ -2,7 +2,7 @@ import { map } from 'lodash' import { useStatusesStore } from 'src/stores/statuses.js' import { useTimelinesStore } from 'src/stores/timelines.js' -import { useUsersStore } from 'src/stores/users.js' +import { useOAuthStore } from 'src/stores/oauth.js' import { editStatus as apiEditStatus, @@ -28,7 +28,7 @@ const postStatus = ({ const mediaIds = map(media, 'id') return apiPostStatus({ - credentials: useUsersStore().currentUser.credentials, + credentials: useOAuthStore().token status, spoilerText, visibility, @@ -71,7 +71,7 @@ const editStatus = ({ return apiEditStatus({ id: statusId, - credentials: useUsersStore().currentUser.credentials, + credentials: useOAuthStore().token status, spoilerText, sensitive, @@ -101,12 +101,12 @@ const editStatus = ({ } const uploadMedia = ({ store, formData }) => { - const credentials = useUsersStore().currentUser.credentials + const credentials = useOAuthStore().token return apiUploadMedia({ credentials, formData }).then(({ data }) => data) } const setMediaDescription = ({ store, id, description }) => { - const credentials = useUsersStore().currentUser.credentials + const credentials = useOAuthStore().token return apiSetMediaDescription({ credentials, id, description }).then( ({ data }) => data, ) diff --git a/src/stores/instance.js b/src/stores/instance.js index 123f0b819..12480e8c1 100644 --- a/src/stores/instance.js +++ b/src/stores/instance.js @@ -14,6 +14,7 @@ import { import { useInterfaceStore } from 'src/stores/interface.js' import { useUsersStore } from 'src/stores/users.js' +import { useOAuthStore } from 'src/stores/oauth.js' import { fetchKnownDomains } from 'src/api/public.js' @@ -213,7 +214,7 @@ export const useInstanceStore = defineStore('instance', { async getKnownDomains() { try { const { data } = await fetchKnownDomains({ - credentials: useUsersStore().currentUser.credentials, + credentials: useOAuthStore().token }) this.knownDomains = data } catch (e) { diff --git a/src/stores/interface.js b/src/stores/interface.js index 0eba6f158..5dd4fa8df 100644 --- a/src/stores/interface.js +++ b/src/stores/interface.js @@ -854,7 +854,7 @@ export const useInterfaceStore = defineStore('interface', { }, unregisterPushNotifications() { - const token = this.currentUser.credentials + const token = useOAuthStore().token unregisterPushNotifications(token) },