Skip to content

Commit

Permalink
fix(Sitemap): Use response data
Browse files Browse the repository at this point in the history
Our ajax library returns the parsed json as response.data. The former was part of the fetch() api that we used before.
  • Loading branch information
tvdeyen committed Mar 24, 2022
1 parent 0a832c4 commit 26c4aa6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package/src/page_sorter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function onFinishDragging(evt) {

patch(url, data)
.then(async (response) => {
const pageData = await response.json()
const pageData = await response.data
const pageEl = document.getElementById(`page_${pageId}`)
const urlPathEl = pageEl.querySelector(".sitemap_url")

Expand Down
8 changes: 4 additions & 4 deletions package/src/sitemap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// The admin sitemap Alchemy class
import PageSorter from "./page_sorter"
import { on } from "./utils/events"
import { patch } from "./utils/ajax"
import { get, patch } from "./utils/ajax"
import { createSortables, displayPageFolders } from "./page_sorter"

export default class Sitemap {
Expand Down Expand Up @@ -31,9 +31,9 @@ export default class Sitemap {
const spinTarget = this.sitemap_wrapper
spinTarget.innerHTML = ""
spinner.spin(spinTarget)
fetch(`${this.options.url}?id=${pageId}`)
get(this.options.url, { id: pageId })
.then(async (response) => {
this.render(await response.json())
this.render(await response.data)
this.handlePageFolders()
spinner.stop()
})
Expand All @@ -55,7 +55,7 @@ export default class Sitemap {

patch(Alchemy.routes.fold_admin_page_path(pageId))
.then(async (response) => {
this.reRender(pageId, await response.json())
this.reRender(pageId, await response.data)
spinner.stop()
})
.catch(this.errorHandler)
Expand Down

0 comments on commit 26c4aa6

Please sign in to comment.