aboutsummaryrefslogtreecommitdiff
path: root/src/logic/EditorActions.ts
blob: 875fdc42848bd42a887710d3c4dbfcc45640f777 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { parseLabSchedule, parsePTSchedule } from "../util/parser";

export async function parsePTFile(file: File) {
    try {
        const text = await file.text();
        return parsePTSchedule(text);
    } catch (error) {
        console.error(file.name, error);
        throw error;
    }
}

export async function parseLabScheduleFile(file: File) {
    const text = await file.text();
    try {
        const labSchedule = JSON.parse(text);
        return parseLabSchedule(labSchedule);
    } catch (error) {
        console.error(file.name, error);
        throw error;
    }
}