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.
|
|
|
import JSONTemplateAdapter from './JSONTemplateAdapter'
|
|
|
|
import { useNuxtApp } from '#imports'
|
|
|
|
|
|
|
|
export default class JSONUrlTemplateAdapter extends JSONTemplateAdapter {
|
|
|
|
url: string
|
|
|
|
$api: any
|
|
|
|
|
|
|
|
constructor(url: string, parserConfig: Record<string, any>) {
|
|
|
|
const { $api } = useNuxtApp()
|
|
|
|
const name = url.split('/').pop()
|
|
|
|
super(name, parserConfig)
|
|
|
|
this.url = url
|
|
|
|
this.$api = $api
|
|
|
|
}
|
|
|
|
|
|
|
|
async init() {
|
|
|
|
const data = await this.$api.utils.axiosRequestMake({
|
|
|
|
apiMeta: {
|
|
|
|
url: this.url,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
this._jsonData = data
|
|
|
|
await super.init()
|
|
|
|
}
|
|
|
|
}
|