feat: Add filter taxonomies by org (#755)

This implements filtering taxonomies on the taxonomy list page by selecting organization name, all taxonomies, or unassigned taxonomies.
This commit is contained in:
Yusuf Musleh
2024-01-04 15:20:32 +03:00
committed by GitHub
parent 4ffebdac77
commit 278862127b
10 changed files with 227 additions and 15 deletions

View File

@@ -1,3 +1,4 @@
// @ts-check
import { camelCaseObject, getConfig } from '@edx/frontend-platform';
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
@@ -9,8 +10,8 @@ export const getCourseRerunUrl = (courseId) => new URL(`/api/contentstore/v1/cou
export const getOrganizationsUrl = () => new URL('organizations', getApiBaseUrl()).href;
/**
* Get's organizations data.
* @returns {Promise<Object>}
* Get's organizations data. Returns list of organization names.
* @returns {Promise<string[]>}
*/
export async function getOrganizations() {
const { data } = await getAuthenticatedHttpClient().get(
@@ -32,7 +33,7 @@ export async function getCourseRerun(courseId) {
/**
* Create or rerun course with data.
* @param {object} data
* @param {object} courseData
* @returns {Promise<Object>}
*/
export async function createOrRerunCourse(courseData) {

View File

@@ -0,0 +1,15 @@
// @ts-check
import { useQuery } from '@tanstack/react-query';
import { getOrganizations } from './api';
/**
* Builds the query to get a list of available organizations
*/
export const useOrganizationListData = () => (
useQuery({
queryKey: ['organizationList'],
queryFn: () => getOrganizations(),
})
);
export default useOrganizationListData;