More work on builder API refactor
This commit is contained in:
parent
e2fb5f51f5
commit
6319760b8c
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { tables } from "stores/backend"
|
||||
import api from "builderStore/api"
|
||||
import { API } from "api"
|
||||
import { Select, Label, Multiselect } from "@budibase/bbui"
|
||||
import { capitalise } from "../../helpers"
|
||||
|
||||
|
@ -17,12 +17,9 @@
|
|||
$: fetchRows(linkedTableId)
|
||||
|
||||
async function fetchRows(linkedTableId) {
|
||||
const FETCH_ROWS_URL = `/api/${linkedTableId}/rows`
|
||||
try {
|
||||
const response = await api.get(FETCH_ROWS_URL)
|
||||
rows = await response.json()
|
||||
rows = await API.fetchTableData(linkedTableId)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
rows = []
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { writable } from "svelte/store"
|
||||
import api from "builderStore/api"
|
||||
import { API } from "api"
|
||||
|
||||
export default function (url) {
|
||||
const store = writable({ status: "LOADING", data: {}, error: {} })
|
||||
|
@ -7,8 +7,8 @@ export default function (url) {
|
|||
async function get() {
|
||||
store.update(u => ({ ...u, status: "LOADING" }))
|
||||
try {
|
||||
const response = await api.get(url)
|
||||
store.set({ data: await response.json(), status: "SUCCESS" })
|
||||
const data = await API.get({ url })
|
||||
store.set({ data, status: "SUCCESS" })
|
||||
} catch (e) {
|
||||
store.set({ data: {}, error: e, status: "ERROR" })
|
||||
}
|
||||
|
|
|
@ -30,4 +30,14 @@ export const buildAppEndpoints = API => ({
|
|||
url: "/api/deploy",
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Reverts an app to a previous version.
|
||||
* @param appId the app ID to revert
|
||||
*/
|
||||
revertApp: async appId => {
|
||||
return await API.post({
|
||||
url: `/api/dev/${appId}/revert`,
|
||||
})
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue