mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-02 18:58:37 +00:00
[UI] API Context (#8851)
* Create ApiContext provider * Utilize new context * Remove api from global context * Refactor <InvenTreeTable> - No longer need hard-coded API constant * Refactor useInstance hook * Refactoring - QueryCountDatshboardWidget - NotesEditor - RenderInstance * Refactor multiple tables * Fix typos * Refactor useFilters hook - Allow plugins to use this hook! * Further refactoring * Refactor API forms * Cleanup context routing * Fix provision order
This commit is contained in:
@@ -7,7 +7,7 @@ import 'easymde/dist/easymde.min.css';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import SimpleMDE from 'react-simplemde-editor';
|
||||
|
||||
import { api } from '../../App';
|
||||
import { useApi } from '../../contexts/ApiContext';
|
||||
import { ApiEndpoints } from '../../enums/ApiEndpoints';
|
||||
import type { ModelType } from '../../enums/ModelType';
|
||||
import { apiUrl } from '../../states/ApiState';
|
||||
@@ -31,6 +31,7 @@ export default function NotesEditor({
|
||||
modelId: number;
|
||||
editable?: boolean;
|
||||
}>) {
|
||||
const api = useApi();
|
||||
// In addition to the editable prop, we also need to check if the user has "enabled" editing
|
||||
const [editing, setEditing] = useState<boolean>(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user