Fix deleting last items on page
This commit is contained in:
parent
fbcc5ee524
commit
dca1f2cce8
3 changed files with 15 additions and 6 deletions
|
@ -37,10 +37,9 @@ export async function createPack(host, token, packName) {
|
|||
export async function deleteEmojiFile(packName, shortcode, host, token) {
|
||||
return await request({
|
||||
baseURL: baseName(host),
|
||||
url: `/api/pleroma/emoji/packs/${packName}/files`,
|
||||
url: `/api/pleroma/emoji/packs/${packName}/files?shortcode=${shortcode}`,
|
||||
method: 'delete',
|
||||
headers: authHeaders(token),
|
||||
data: { shortcode }
|
||||
headers: authHeaders(token)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -103,8 +103,11 @@ const emojiPacks = {
|
|||
type: 'success',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
|
||||
dispatch('FetchSinglePack', { name: packName, page: state.currentFilesPage })
|
||||
if (Object.keys(updatedPackFiles).length === 0 && state.currentFilesPage > 1) {
|
||||
dispatch('FetchSinglePack', { name: packName, page: state.currentFilesPage - 1 })
|
||||
} else {
|
||||
dispatch('FetchSinglePack', { name: packName, page: state.currentFilesPage })
|
||||
}
|
||||
},
|
||||
async CreatePack({ getters }, { name }) {
|
||||
await createPack(getters.authHost, getters.token, name)
|
||||
|
|
|
@ -195,7 +195,14 @@ export default {
|
|||
}).then(() => {
|
||||
this.$store.dispatch('DeletePack', { name: this.name })
|
||||
.then(() => this.$store.dispatch('ReloadEmoji'))
|
||||
.then(() => this.$store.dispatch('FetchLocalEmojiPacks', this.currentPage))
|
||||
.then(() => {
|
||||
const { [this.name]: value, ...updatedPacks } = this.$store.state.emojiPacks.localPacks
|
||||
if (Object.keys(updatedPacks).length === 0 && this.currentPage > 1) {
|
||||
this.$store.dispatch('FetchLocalEmojiPacks', this.currentPage - 1)
|
||||
} else {
|
||||
this.$store.dispatch('FetchLocalEmojiPacks', this.currentPage)
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
handleChange(openTabs, name) {
|
||||
|
|
Loading…
Reference in a new issue