Renamed NewServerData to ServerData, as it's used in other contexts too

This commit is contained in:
Alejandro Celaya
2020-08-23 10:52:37 +02:00
parent 1b7e1e2b5b
commit 294888454d
5 changed files with 11 additions and 11 deletions

View File

@@ -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);
});