Skip to content

Commit

Permalink
fix: remove @ts-check and move CreateContentLibraryArgs type
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Jun 25, 2024
1 parent 708426c commit 8d71297
Show file tree
Hide file tree
Showing 16 changed files with 9 additions and 25 deletions.
1 change: 0 additions & 1 deletion src/library-authoring/EmptyStates.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import React from 'react';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import {
Expand Down
1 change: 0 additions & 1 deletion src/library-authoring/LibraryAuthoringPage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import React from 'react';
import MockAdapter from 'axios-mock-adapter';
import { initializeMockApp } from '@edx/frontend-platform';
Expand Down
1 change: 0 additions & 1 deletion src/library-authoring/LibraryAuthoringPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import React, { useEffect, useState } from 'react';
import { StudioFooter } from '@edx/frontend-component-footer';
import { useIntl } from '@edx/frontend-platform/i18n';
Expand Down
1 change: 0 additions & 1 deletion src/library-authoring/LibraryCollections.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import React from 'react';
import { FormattedMessage } from '@edx/frontend-platform/i18n';

Expand Down
1 change: 0 additions & 1 deletion src/library-authoring/LibraryComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import React from 'react';
import { FormattedMessage } from '@edx/frontend-platform/i18n';

Expand Down
1 change: 0 additions & 1 deletion src/library-authoring/LibraryHome.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import React from 'react';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import React from 'react';
import MockAdapter from 'axios-mock-adapter';
import { initializeMockApp } from '@edx/frontend-platform';
Expand Down
5 changes: 2 additions & 3 deletions src/library-authoring/create-library/CreateLibrary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import React, { useState } from 'react';
import { StudioFooter } from '@edx/frontend-component-footer';
import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n';
Expand All @@ -19,10 +18,10 @@ import FormikControl from '../../generic/FormikControl';
import FormikErrorFeedback from '../../generic/FormikErrorFeedback';
import { useOrganizationListData } from '../../generic/data/apiHooks';
import SubHeader from '../../generic/sub-header/SubHeader';
import type { CreateContentLibraryArgs } from './data/api';
import { useCreateLibraryV2 } from './data/apiHooks';
import messages from './messages';

import type { CreateContentLibraryDto } from './data/types';

const CreateLibrary = () => {
const intl = useIntl();
Expand Down Expand Up @@ -74,7 +73,7 @@ const CreateLibrary = () => {
),
})
}
onSubmit={async (values: CreateContentLibraryDto) => {
onSubmit={async (values: CreateContentLibraryArgs) => {
setApiError(undefined);
try {
const data = await mutateAsync(values);
Expand Down
11 changes: 7 additions & 4 deletions src/library-authoring/create-library/data/api.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
// @ts-check
import { camelCaseObject, getConfig } from '@edx/frontend-platform';
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';

import type { CreateContentLibraryDto } from './types';

const getApiBaseUrl = () => getConfig().STUDIO_BASE_URL;

/**
* Get the URL for creating a new library.
*/
export const getContentLibraryV2CreateApiUrl = () => `${getApiBaseUrl()}/api/libraries/v2/`;

export interface CreateContentLibraryArgs {
title: string,
org: string,
slug: string,
}

/**
* Create a new library
*/
export async function createLibraryV2(data: CreateContentLibraryDto) {
export async function createLibraryV2(data: CreateContentLibraryArgs) {
const client = getAuthenticatedHttpClient();
const url = getContentLibraryV2CreateApiUrl();

Expand Down
1 change: 0 additions & 1 deletion src/library-authoring/create-library/data/apiHooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import {
useMutation,
useQueryClient,
Expand Down
5 changes: 0 additions & 5 deletions src/library-authoring/create-library/data/types.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/library-authoring/create-library/messages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import { defineMessages } from '@edx/frontend-platform/i18n';

const messages = defineMessages({
Expand Down
1 change: 0 additions & 1 deletion src/library-authoring/data/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import { camelCaseObject, getConfig } from '@edx/frontend-platform';
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';

Expand Down
1 change: 0 additions & 1 deletion src/library-authoring/data/apiHook.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import React from 'react';
import { useQuery } from '@tanstack/react-query';
import { MeiliSearch } from 'meilisearch';
Expand Down
1 change: 0 additions & 1 deletion src/library-authoring/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// @ts-check
export { default as LibraryAuthoringPage } from './LibraryAuthoringPage';
export { CreateLibrary } from './create-library';
1 change: 0 additions & 1 deletion src/library-authoring/messages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-check
import { defineMessages } from '@edx/frontend-platform/i18n';

const messages = defineMessages({
Expand Down

0 comments on commit 8d71297

Please sign in to comment.