feat: use different resource for listing songs in albums

This commit is contained in:
Deluan
2020-02-14 09:02:32 -05:00
parent b2d022b823
commit 7f94660183
5 changed files with 24 additions and 11 deletions
+4 -1
View File
@@ -1,7 +1,10 @@
import { fetchUtils } from 'react-admin'
import jsonServerProvider from 'ra-data-json-server'
const baseUrl = '/app/api'
const httpClient = (url, options = {}) => {
url = url.replace(baseUrl + '/albumSong', baseUrl + '/song')
if (!options.headers) {
options.headers = new Headers({ Accept: 'application/json' })
}
@@ -19,6 +22,6 @@ const httpClient = (url, options = {}) => {
})
}
const dataProvider = jsonServerProvider('/app/api', httpClient)
const dataProvider = jsonServerProvider(baseUrl, httpClient)
export default dataProvider