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:
@@ -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) {
|
||||
|
||||
15
src/generic/data/apiHooks.js
Normal file
15
src/generic/data/apiHooks.js
Normal 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;
|
||||
Reference in New Issue
Block a user