mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-01 18:56:36 +00:00
32 lines
770 B
TypeScript
32 lines
770 B
TypeScript
import type { Api } from 'nocodb-sdk'
|
|
import JSONTemplateAdapter from './JSONTemplateAdapter'
|
|
import type { ProgressMessageType } from './TemplateGenerator'
|
|
|
|
export default class JSONUrlTemplateAdapter extends JSONTemplateAdapter {
|
|
url: string
|
|
$api: any
|
|
|
|
constructor(
|
|
url: string,
|
|
parserConfig: Record<string, any>,
|
|
api: Api<any>,
|
|
progressCallback?: (msg: ProgressMessageType) => void,
|
|
) {
|
|
// const { $api } = useNuxtApp()
|
|
super({}, parserConfig, progressCallback)
|
|
this.url = url
|
|
this.$api = api
|
|
}
|
|
|
|
async init() {
|
|
this.progress('Downloading json file')
|
|
const data = await this.$api.utils.axiosRequestMake({
|
|
apiMeta: {
|
|
url: this.url,
|
|
},
|
|
})
|
|
this._jsonData = data
|
|
await super.init()
|
|
}
|
|
}
|