Browse Source

feat(gui-v2): JSONUrlTemplateAdpter

pull/2795/head
Wing-Kam Wong 2 years ago
parent
commit
030020e7f2
  1. 21
      packages/nc-gui-v2/utils/parsers/JSONUrlTemplateAdapter.ts

21
packages/nc-gui-v2/utils/parsers/JSONUrlTemplateAdapter.ts

@ -0,0 +1,21 @@
import JSONTemplateAdapter from './JSONTemplateAdapter'
const { $api } = useNuxtApp()
export default class JSONUrlTemplateAdapter extends JSONTemplateAdapter {
url: string
constructor(url: string, parserConfig: Record<string, any>) {
const name = url.split('/').pop()
super(name, parserConfig)
this.url = url
}
async init() {
const data = await $api.utils.axiosRequestMake({
apiMeta: {
url: this.url,
},
})
this._jsonData = data
await super.init()
}
}
Loading…
Cancel
Save