mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
593 B
26 lines
593 B
2 years ago
|
import JSONTemplateAdapter from './JSONTemplateAdapter'
|
||
2 years ago
|
import { useNuxtApp } from '#imports'
|
||
2 years ago
|
|
||
|
export default class JSONUrlTemplateAdapter extends JSONTemplateAdapter {
|
||
|
url: string
|
||
2 years ago
|
$api: any
|
||
|
|
||
2 years ago
|
constructor(url: string, parserConfig: Record<string, any>) {
|
||
2 years ago
|
const { $api } = useNuxtApp()
|
||
2 years ago
|
const name = url.split('/').pop()
|
||
|
super(name, parserConfig)
|
||
|
this.url = url
|
||
2 years ago
|
this.$api = $api
|
||
2 years ago
|
}
|
||
|
|
||
|
async init() {
|
||
2 years ago
|
const data = await this.$api.utils.axiosRequestMake({
|
||
2 years ago
|
apiMeta: {
|
||
|
url: this.url,
|
||
|
},
|
||
|
})
|
||
|
this._jsonData = data
|
||
|
await super.init()
|
||
|
}
|
||
|
}
|