mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-17 13:03:50 +00:00
Renamed NewServerData to ServerData, as it's used in other contexts too
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { CsvJson } from 'csvjson';
|
||||
import { NewServerData } from '../data';
|
||||
import { ServerData } from '../data';
|
||||
|
||||
const CSV_MIME_TYPE = 'text/csv';
|
||||
|
||||
export default class ServersImporter {
|
||||
public constructor(private readonly csvjson: CsvJson, private readonly fileReaderFactory: () => FileReader) {}
|
||||
|
||||
public importServersFromFile = async (file?: File | null): Promise<NewServerData[]> => {
|
||||
public importServersFromFile = async (file?: File | null): Promise<ServerData[]> => {
|
||||
if (!file || file.type !== CSV_MIME_TYPE) {
|
||||
throw new Error('No file provided or file is not a CSV');
|
||||
}
|
||||
@@ -16,7 +16,7 @@ export default class ServersImporter {
|
||||
return new Promise((resolve) => {
|
||||
reader.addEventListener('loadend', (e: ProgressEvent<FileReader>) => {
|
||||
const content = e.target?.result?.toString() ?? '';
|
||||
const servers = this.csvjson.toObject<NewServerData>(content);
|
||||
const servers = this.csvjson.toObject<ServerData>(content);
|
||||
|
||||
resolve(servers);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user