@@ -351,21 +463,15 @@ const SearchDialog = ({ searchInfo, onClose }: Props) => {
{visibleLectures.map((lecture, index) => (
-
- | {lecture.id} |
- {lecture.grade} |
- {lecture.title} |
- {lecture.credits} |
- |
- |
-
-
- |
-
+
))}
-
+
@@ -375,4 +481,4 @@ const SearchDialog = ({ searchInfo, onClose }: Props) => {
);
};
-export default SearchDialog;
\ No newline at end of file
+export default SearchDialog;
diff --git a/src/utils.ts b/src/utils.ts
index 8b6eb66..161ec54 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -11,12 +11,11 @@ const getTimeRange = (value: string): number[] => {
return Array(end - start + 1)
.fill(start)
.map((v, k) => v + k);
-}
+};
export const parseSchedule = (schedule: string) => {
- const schedules = schedule.split('');
- return schedules.map(schedule => {
-
+ const schedules = schedule.split("
");
+ return schedules.map((schedule) => {
const reg = /^([가-힣])(\d+(~\d+)?)(.*)/;
const [day] = schedule.split(/(\d+)/);
@@ -28,3 +27,16 @@ export const parseSchedule = (schedule: string) => {
return { day, range, room };
});
};
+
+export const withCache = (fetchFn: () => Promise) => {
+ let cachedData: T | null = null;
+
+ return async (): Promise => {
+ if (cachedData) {
+ return cachedData;
+ }
+
+ cachedData = await fetchFn();
+ return cachedData;
+ };
+};
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
new file mode 100644
index 0000000..e3182d2
--- /dev/null
+++ b/src/vite-env.d.ts
@@ -0,0 +1,9 @@
+///
+
+interface ImportMetaEnv {
+ readonly BASE_URL: string;
+}
+
+interface ImportMeta {
+ readonly env: ImportMetaEnv;
+}
diff --git a/vite.config.ts b/vite.config.ts
index 1cdac55..3a52d68 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -5,6 +5,7 @@ import react from '@vitejs/plugin-react-swc';
export default mergeConfig(
defineConfig({
plugins: [react()],
+ base: '/front_7th_chapter4-2/',
}),
defineTestConfig({
test: {