Skip to content

Commit

Permalink
Update more to be called moreParams and update channels route name
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVelezLl committed Dec 17, 2024
1 parent e8f90f3 commit b7fa010
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion kolibri/plugins/coach/assets/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class CoachToolsModule extends KolibriApp {
PageNames.LESSON_PREVIEW_RESOURCE,
PageNames.LESSON_SELECT_RESOURCES_INDEX,
PageNames.LESSON_SELECT_RESOURCES_BOOKMARKS,
PageNames.LESSON_SELECT_RESOURCES_CHANNELS,
PageNames.LESSON_SELECT_RESOURCES_TOPIC_TREE,
];
// If we're navigating to the same page for a quiz summary page, don't set loading
if (
Expand Down
14 changes: 7 additions & 7 deletions kolibri/plugins/coach/assets/src/composables/useFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { ref, computed } from 'vue';
* * This function receives a "moreParams" object as its first argument. This moreParams object is
* from the "more" property of the response from the previous fetch to fetch more data.
* * Should return a Promise resolving to { results: any[], more: any }. The "results" property
* should be the fetched data and the "more" property should be the next "more" object to use
* in the next fetchMore method.
* should be the fetched data and the "more" property should be the next "moreParams" object to
* use in the next fetchMore method.
* * FetchMore just works if the fetched data is an array
*
* Example:
Expand Down Expand Up @@ -56,11 +56,11 @@ export default function useFetch(options) {
const loading = ref(false);
const data = ref(null);
const error = ref(null);
const more = ref(null);
const moreParams = ref(null);
const count = ref(null);
const loadingMore = ref(false);

const hasMore = computed(() => more.value != null);
const hasMore = computed(() => moreParams.value != null);

const _setData = (response, loadingMore) => {
const responseData = fetchMoreMethod ? response.results : response;
Expand All @@ -74,7 +74,7 @@ export default function useFetch(options) {
data.value = responseData;
}

more.value = response.more || null;
moreParams.value = response.more || null;
count.value = response.count || null;
};

Expand All @@ -93,15 +93,15 @@ export default function useFetch(options) {
};

const fetchMore = async (...args) => {
if (!more.value || !fetchMoreMethod) {
if (!moreParams.value || !fetchMoreMethod) {
return;
}

loadingMore.value = true;
error.value = null;

try {
const response = await fetchMoreMethod(more.value, ...args);
const response = await fetchMoreMethod(moreParams.value, ...args);
_setData(response, loadingMore.value);
} catch (err) {
error.value = err;
Expand Down
2 changes: 1 addition & 1 deletion kolibri/plugins/coach/assets/src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const PageNames = {
LESSON_SELECT_RESOURCES: 'LESSON_SELECT_RESOURCES',
LESSON_SELECT_RESOURCES_INDEX: 'LESSON_SELECT_RESOURCES_INDEX',
LESSON_SELECT_RESOURCES_BOOKMARKS: 'LESSON_SELECT_RESOURCES_BOOKMARKS',
LESSON_SELECT_RESOURCES_CHANNELS: 'LESSON_SELECT_RESOURCES_CHANNELS',
LESSON_SELECT_RESOURCES_TOPIC_TREE: 'LESSON_SELECT_RESOURCES_TOPIC_TREE',
LESSON_PREVIEW_SELECTED_RESOURCES: 'LESSON_PREVIEW_SELECTED_RESOURCES',
LESSON_PREVIEW_RESOURCE: 'LESSON_PREVIEW_RESOURCE',
LESSON_LEARNER_REPORT: 'LESSON_LEARNER_REPORT',
Expand Down
2 changes: 1 addition & 1 deletion kolibri/plugins/coach/assets/src/routes/lessonsRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export default [
component: SelectFromBookmarks,
},
{
name: PageNames.LESSON_SELECT_RESOURCES_CHANNELS,
name: PageNames.LESSON_SELECT_RESOURCES_TOPIC_TREE,
path: 'channels',
component: SelectFromChannels,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
methods: {
selectFromChannelsLink(channel) {
return {
name: PageNames.LESSON_SELECT_RESOURCES_CHANNELS,
name: PageNames.LESSON_SELECT_RESOURCES_TOPIC_TREE,
query: { topicId: channel.id },
};
},
Expand Down

0 comments on commit b7fa010

Please sign in to comment.