diff --git a/src/pages/users/components/CreateUserForm/CreateUserForm.tsx b/src/pages/users/components/CreateUserForm/CreateUserForm.tsx index c94ae88..c4ebc03 100644 --- a/src/pages/users/components/CreateUserForm/CreateUserForm.tsx +++ b/src/pages/users/components/CreateUserForm/CreateUserForm.tsx @@ -82,6 +82,8 @@ const CreateUserModal: React.FC = ({ me }) => { role: searchingRole, search, }); + toast({ title: 'User created.', status: 'info' }); + /** * Clear form state */ diff --git a/src/services/CourseService.ts b/src/services/CourseService.ts index 5916911..47093e7 100644 --- a/src/services/CourseService.ts +++ b/src/services/CourseService.ts @@ -1,18 +1,6 @@ import { AxiosInstance } from 'axios'; -import { CourseStatusEnum } from 'enums'; import { IApiRespose, ICourse } from 'interfaces'; - -export type FetchCoursesParams = { - /** - * Get courses by status - */ - status?: CourseStatusEnum; - - /** - * Get courses with category by id - */ - category_id?: string; -}; +import { FetchCoursesParams } from 'types'; export class CourseService { public api: AxiosInstance; diff --git a/src/services/UserService.ts b/src/services/UserService.ts index 70acd5b..361f712 100644 --- a/src/services/UserService.ts +++ b/src/services/UserService.ts @@ -1,18 +1,7 @@ import { AxiosInstance } from 'axios'; import { IApiRespose, IMe, IUser, IUserContacts } from 'interfaces'; import * as helpers from 'helpers'; -import { UserRoleEnum } from 'enums'; - -export type FetchUsersParamsType = { page?: number; limit?: number; role?: UserRoleEnum | 'any'; search?: string }; -export type CreateUserParamsType = { - first_name: string; - last_name: string; - login: string; - email: string; - role: UserRoleEnum; - password: string; -}; -export type UpdateUserParamsType = { first_name?: string; last_name?: string; email?: string }; +import { CreateUserParamsType, FetchUsersParamsType, UpdateUserParamsType } from 'types'; export default class UserService { public api: AxiosInstance; diff --git a/src/stores/CategoryStore.ts b/src/stores/CategoryStore.ts index 4f3420d..04b179a 100644 --- a/src/stores/CategoryStore.ts +++ b/src/stores/CategoryStore.ts @@ -1,7 +1,19 @@ import { AxiosInstance } from 'axios'; -import { ICategory } from 'interfaces'; import { makeAutoObservable, runInAction } from 'mobx'; + +/** + * Types + */ +import { ICategory } from 'interfaces'; + +/** + * Services + */ import CategoryService from 'services/CategoryService'; + +/** + * Stores + */ import RootStore from './RootStore'; export default class CategoryStore { diff --git a/src/stores/CourseStore.ts b/src/stores/CourseStore.ts index 99499c9..6183e7e 100644 --- a/src/stores/CourseStore.ts +++ b/src/stores/CourseStore.ts @@ -1,7 +1,20 @@ import { AxiosInstance } from 'axios'; -import { ICourse } from 'interfaces'; import { makeAutoObservable, runInAction } from 'mobx'; -import { CourseService, FetchCoursesParams } from 'services/CourseService'; + +/** + * Types + */ +import { FetchCoursesParams } from 'types'; +import { ICourse } from 'interfaces'; + +/** + * Services + */ +import { CourseService } from 'services/CourseService'; + +/** + * Stores + */ import RootStore from './RootStore'; export default class CourseStore { diff --git a/src/stores/UIStore.ts b/src/stores/UIStore.ts index 44d2d2b..263cc47 100644 --- a/src/stores/UIStore.ts +++ b/src/stores/UIStore.ts @@ -1,5 +1,9 @@ import { makeAutoObservable, observable } from 'mobx'; import { createBrowserHistory } from 'history'; + +/** + * Types + */ import { IWindowDimensions } from 'interfaces'; /** diff --git a/src/stores/UserStore.ts b/src/stores/UserStore.ts index 322e20f..0c94be4 100644 --- a/src/stores/UserStore.ts +++ b/src/stores/UserStore.ts @@ -1,18 +1,23 @@ import { AxiosInstance } from 'axios'; import { makeAutoObservable, runInAction } from 'mobx'; -import { IUser, IUserContacts, IMe, IPaginationMeta } from 'interfaces'; import * as helpers from 'helpers'; +/** + * Types + */ +import { CreateUserParamsType, FetchUsersParamsType, UpdateUserParamsType } from 'types'; +import { IUser, IUserContacts, IMe, IPaginationMeta } from 'interfaces'; +import { UserRoleEnum } from 'enums'; + /** * Services */ -import UserService, { CreateUserParamsType, UpdateUserParamsType, FetchUsersParamsType } from 'services/UserService'; +import UserService from 'services/UserService'; /** * Stores */ import RootStore from './RootStore'; -import { UserRoleEnum } from 'enums'; export default class UserStore { public root: RootStore; diff --git a/src/types/index.d.ts b/src/types/index.d.ts index c843a08..c8bd593 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -81,3 +81,29 @@ export type CoursesPageContextType = { selectedCategory: ICategory | undefined; setSelectedCategory: React.Dispatch>; }; +export type FetchCoursesParams = { + /** + * Get courses by status + */ + status?: CourseStatusEnum; + + /** + * Get courses with category by id + */ + category_id?: string; +}; +export type FetchUsersParamsType = { + page?: number; + limit?: number; + role?: UserRoleEnum | 'any'; + search?: string; +}; +export type CreateUserParamsType = { + first_name: string; + last_name: string; + login: string; + email: string; + role: UserRoleEnum; + password: string; +}; +export type UpdateUserParamsType = { first_name?: string; last_name?: string; email?: string };