Apply 6 suggestion(s) to 3 file(s)

This commit is contained in:
MK Fain 2020-09-27 16:41:01 +00:00 committed by Angelina Filippova
parent 9629862d56
commit c615902cee
3 changed files with 8 additions and 5 deletions

View file

@ -22,10 +22,12 @@ export async function fetchChat(id, authHost, token) {
export async function fetchChatMessages(id, max_id, authHost, token) { export async function fetchChatMessages(id, max_id, authHost, token) {
let url let url
max_id !== null ? url = `/api/pleroma/admin/chats/${id}/messages?max_id=${max_id}` : url = `/api/pleroma/admin/chats/${id}/messages` const url = max_id
? `/api/pleroma/admin/chats/${id}/messages?max_id=${max_id}`
: `/api/pleroma/admin/chats/${id}/messages`
return await request({ return await request({
baseURL: baseName(authHost), baseURL: baseName(authHost),
url: url, url,
method: 'get', method: 'get',
headers: authHeaders(token) headers: authHeaders(token)
}) })

View file

@ -7,7 +7,7 @@ const chat = {
loading: false, loading: false,
buttonLoading: false, buttonLoading: false,
allLoaded: false, allLoaded: false,
max_id: null maxId: null
}, },
mutations: { mutations: {
SET_LOADING: (state, chat) => { SET_LOADING: (state, chat) => {
@ -26,7 +26,7 @@ const chat = {
state.fetchedChatMessages = chatMessages state.fetchedChatMessages = chatMessages
}, },
CHANGE_MAX_ID: (state, max_id) => { CHANGE_MAX_ID: (state, max_id) => {
state.max_id = max_id state.maxId = max_id
} }
}, },
actions: { actions: {
@ -39,7 +39,7 @@ const chat = {
}, },
async FetchChatMessages({ commit, dispatch, getters, state }, id, max_id) { async FetchChatMessages({ commit, dispatch, getters, state }, id, max_id) {
commit('SET_LOADING', true) commit('SET_LOADING', true)
const chat = await fetchChatMessages(id, state.max_id, getters.authHost, getters.token) const chat = await fetchChatMessages(id, state.maxId, getters.authHost, getters.token)
commit('SET_CHAT_MESSAGES', chat.data) commit('SET_CHAT_MESSAGES', chat.data)
commit('SET_LOADING', false) commit('SET_LOADING', false)
}, },

View file

@ -372,6 +372,7 @@ table {
.user-chats-card { .user-chats-card {
width: auto; width: auto;
height: fit-content; height: fit-content;
margin-bottom: 20px;
} }
.user-profile-container { .user-profile-container {
display: flex; display: flex;