レインせんぱいにサンキュー
This commit is contained in:
parent
ce8b5fcd11
commit
27cbe3ca65
|
@ -100,9 +100,10 @@ const UserProfile = {
|
||||||
if (this.userId && !this.$route.params.name) {
|
if (this.userId && !this.$route.params.name) {
|
||||||
fetchPromise = this.$store.dispatch('fetchUser', this.userId)
|
fetchPromise = this.$store.dispatch('fetchUser', this.userId)
|
||||||
} else {
|
} else {
|
||||||
fetchPromise = this.$store.dispatch('fetchUserByScreenName', this.userName)
|
fetchPromise = this.$store.dispatch('fetchUser', this.userName)
|
||||||
.then(userId => {
|
.then(({ id }) => {
|
||||||
this.fetchedUserId = userId
|
console.log(arguments)
|
||||||
|
this.fetchedUserId = id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return fetchPromise
|
return fetchPromise
|
||||||
|
|
|
@ -152,12 +152,10 @@ const users = {
|
||||||
actions: {
|
actions: {
|
||||||
fetchUser (store, id) {
|
fetchUser (store, id) {
|
||||||
return store.rootState.api.backendInteractor.fetchUser({ id })
|
return store.rootState.api.backendInteractor.fetchUser({ id })
|
||||||
.then((user) => store.commit('addNewUsers', [user]))
|
.then((user) => {
|
||||||
},
|
store.commit('addNewUsers', [user])
|
||||||
fetchUserByScreenName (store, screenName) {
|
return user
|
||||||
return store.rootState.api.backendInteractor.figureOutUserId({ screenName })
|
})
|
||||||
.then((qvitterUserData) => store.rootState.api.backendInteractor.fetchUser({ id: qvitterUserData.id }))
|
|
||||||
.then((user) => store.commit('addNewUsers', [user]) || user.id)
|
|
||||||
},
|
},
|
||||||
fetchUserRelationship (store, id) {
|
fetchUserRelationship (store, id) {
|
||||||
return store.rootState.api.backendInteractor.fetchUserRelationship({ id })
|
return store.rootState.api.backendInteractor.fetchUserRelationship({ id })
|
||||||
|
|
|
@ -32,7 +32,6 @@ const QVITTER_USER_NOTIFICATIONS_URL = '/api/qvitter/statuses/notifications.json
|
||||||
const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json'
|
const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json'
|
||||||
const BLOCKING_URL = '/api/blocks/create.json'
|
const BLOCKING_URL = '/api/blocks/create.json'
|
||||||
const UNBLOCKING_URL = '/api/blocks/destroy.json'
|
const UNBLOCKING_URL = '/api/blocks/destroy.json'
|
||||||
const USER_URL = '/api/users/show.json'
|
|
||||||
const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import'
|
const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import'
|
||||||
const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account'
|
const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account'
|
||||||
const CHANGE_PASSWORD_URL = '/api/pleroma/change_password'
|
const CHANGE_PASSWORD_URL = '/api/pleroma/change_password'
|
||||||
|
@ -273,22 +272,6 @@ const fetchUserRelationship = ({id, credentials}) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO remove once MastoAPI supports screen_name in fetchUser one
|
|
||||||
const figureOutUserId = ({screenName, credentials}) => {
|
|
||||||
let url = `${USER_URL}/?user_id=${screenName}`
|
|
||||||
return fetch(url, { headers: authHeaders(credentials) })
|
|
||||||
.then((response) => {
|
|
||||||
return new Promise((resolve, reject) => response.json()
|
|
||||||
.then((json) => {
|
|
||||||
if (!response.ok) {
|
|
||||||
return reject(new StatusCodeError(response.status, json, { url }, response))
|
|
||||||
}
|
|
||||||
return resolve(json)
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
.then((data) => parseUser(data))
|
|
||||||
}
|
|
||||||
|
|
||||||
const fetchFriends = ({id, page, credentials}) => {
|
const fetchFriends = ({id, page, credentials}) => {
|
||||||
let url = `${FRIENDS_URL}?user_id=${id}`
|
let url = `${FRIENDS_URL}?user_id=${id}`
|
||||||
if (page) {
|
if (page) {
|
||||||
|
@ -622,7 +605,6 @@ const apiService = {
|
||||||
unblockUser,
|
unblockUser,
|
||||||
fetchUser,
|
fetchUser,
|
||||||
fetchUserRelationship,
|
fetchUserRelationship,
|
||||||
figureOutUserId,
|
|
||||||
favorite,
|
favorite,
|
||||||
unfavorite,
|
unfavorite,
|
||||||
retweet,
|
retweet,
|
||||||
|
|
|
@ -26,10 +26,6 @@ const backendInteractorService = (credentials) => {
|
||||||
return apiService.fetchAllFollowing({username, credentials})
|
return apiService.fetchAllFollowing({username, credentials})
|
||||||
}
|
}
|
||||||
|
|
||||||
const figureOutUserId = ({screenName}) => {
|
|
||||||
return apiService.figureOutUserId({screenName, credentials})
|
|
||||||
}
|
|
||||||
|
|
||||||
const fetchUser = ({id}) => {
|
const fetchUser = ({id}) => {
|
||||||
return apiService.fetchUser({id, credentials})
|
return apiService.fetchUser({id, credentials})
|
||||||
}
|
}
|
||||||
|
@ -99,7 +95,6 @@ const backendInteractorService = (credentials) => {
|
||||||
unfollowUser,
|
unfollowUser,
|
||||||
blockUser,
|
blockUser,
|
||||||
unblockUser,
|
unblockUser,
|
||||||
figureOutUserId,
|
|
||||||
fetchUser,
|
fetchUser,
|
||||||
fetchUserRelationship,
|
fetchUserRelationship,
|
||||||
fetchAllFollowing,
|
fetchAllFollowing,
|
||||||
|
|
Loading…
Reference in New Issue