Skip to content

Commit 69054dd

Browse files
committed
save data on fetch
1 parent 7e45537 commit 69054dd

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/App.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@ const App = () => {
103103
});
104104

105105
const saveCourses = () => {
106+
toast.loading("Saving courses...");
106107
checkCoursesValid();
107108
localStorage.setItem("courses", JSON.stringify(courses));
109+
toast.remove();
110+
toast.success("Course CRNs saved!");
108111
};
109112

110113
const checkCoursesValid = async () => {
@@ -134,9 +137,9 @@ const App = () => {
134137
return;
135138
}
136139

137-
setData("Loading");
140+
saveCourses();
141+
// setData("Loading");
138142
toast.loading("Fetching your data");
139-
checkCoursesValid();
140143

141144
const courseArr = courses
142145
.filter((el: Course) => {

src/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { invoke } from "@tauri-apps/api/tauri";
22
import { open } from "@tauri-apps/api/shell";
33

4+
export const courseMIN = 10000;
5+
export const courseMAX = 99999;
6+
47
export type Course = {
58
id: number;
69
courseNum: number;
@@ -9,10 +12,6 @@ export type Course = {
912
valid: boolean;
1013
};
1114

12-
export const openLink = async () => {
13-
open("https://oscar.gatech.edu/bprod/twbkwbis.P_GenMenu?name=bmenu.P_RegMnu");
14-
};
15-
1615
const existingCourses: number[] = [];
1716
const nonExistingCourses: number[] = [];
1817

@@ -59,5 +58,6 @@ export const get_courses = async (courseArr: number[]) => {
5958
return data as string;
6059
};
6160

62-
export const courseMIN = 10000;
63-
export const courseMAX = 99999;
61+
export const openLink = async () => {
62+
open("https://oscar.gatech.edu/bprod/twbkwbis.P_GenMenu?name=bmenu.P_RegMnu");
63+
};

0 commit comments

Comments
 (0)