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.
33 lines
743 B
33 lines
743 B
1 year ago
|
import type { Api } from 'nocodb-sdk'
|
||
2 years ago
|
import ExcelTemplateAdapter from './ExcelTemplateAdapter'
|
||
|
|
||
|
export default class ExcelUrlTemplateAdapter extends ExcelTemplateAdapter {
|
||
|
url: string
|
||
|
excelData: any
|
||
2 years ago
|
$api: any
|
||
2 years ago
|
|
||
1 year ago
|
constructor(
|
||
|
url: string,
|
||
|
parserConfig: Record<string, any>,
|
||
|
api: Api<any>,
|
||
|
xlsx: any = null,
|
||
|
progressCallback?: (msg: string) => void,
|
||
|
) {
|
||
|
super({}, parserConfig, xlsx, progressCallback)
|
||
2 years ago
|
this.url = url
|
||
|
this.excelData = null
|
||
1 year ago
|
this.$api = api
|
||
2 years ago
|
}
|
||
|
|
||
|
async init() {
|
||
1 year ago
|
this.progress('Downloading excel file')
|
||
2 years ago
|
const data: any = await this.$api.utils.axiosRequestMake({
|
||
2 years ago
|
apiMeta: {
|
||
|
url: this.url,
|
||
|
},
|
||
|
})
|
||
|
this.excelData = data.data
|
||
|
await super.init()
|
||
|
}
|
||
|
}
|