chore: remove unused code
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
export const load = ({ params = { slug: '' } }) => {
|
export const load = () => {
|
||||||
return {
|
return {
|
||||||
allCourses: [],
|
|
||||||
cantFetch: true
|
cantFetch: true
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
|
||||||
import { Search, Dropdown } from 'carbon-components-svelte';
|
import { Search, Dropdown } from 'carbon-components-svelte';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { profile } from '$lib/utils/store/user';
|
import { profile } from '$lib/utils/store/user';
|
||||||
@@ -16,7 +15,7 @@
|
|||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
let { allCourses, cantFetch } = data;
|
let { cantFetch } = data;
|
||||||
let searchValue = '';
|
let searchValue = '';
|
||||||
let selectedId: string;
|
let selectedId: string;
|
||||||
let filteredCourses: Course[];
|
let filteredCourses: Course[];
|
||||||
@@ -29,7 +28,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getCourses(userId: string | null, orgId: string) {
|
async function getCourses(userId: string | null, orgId: string) {
|
||||||
if (cantFetch && typeof cantFetch === 'boolean' && !allCourses.length && orgId && !hasFetched) {
|
if (cantFetch && typeof cantFetch === 'boolean' && orgId && !hasFetched) {
|
||||||
// only show is loading when fetching for the first time
|
// only show is loading when fetching for the first time
|
||||||
if (!$courses.length) {
|
if (!$courses.length) {
|
||||||
$courseMetaDeta.isLoading = true;
|
$courseMetaDeta.isLoading = true;
|
||||||
@@ -75,10 +74,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
courses.set(allCourses);
|
|
||||||
});
|
|
||||||
|
|
||||||
$: filterCourses(searchValue, selectedId, $courses);
|
$: filterCourses(searchValue, selectedId, $courses);
|
||||||
$: getCourses($profile.id, $currentOrg.id);
|
$: getCourses($profile.id, $currentOrg.id);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user