sem clerk
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useOrganization } from '@clerk/clerk-react';
|
||||
import { Plus, Pencil, Trash2, Box, RefreshCw } from 'lucide-react';
|
||||
import { Button } from '../Button';
|
||||
import { Modal } from '../Modal';
|
||||
import { Input } from '../Input';
|
||||
import * as geometryService from '../../services/geometryTypeService';
|
||||
import type { GeometryType } from '../../types';
|
||||
import { useAuth } from '../../context/useAuth';
|
||||
|
||||
export const GeometrySettings: React.FC = () => {
|
||||
const { organization } = useOrganization();
|
||||
const { appUser } = useAuth();
|
||||
const [types, setTypes] = useState<GeometryType[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
@@ -20,13 +20,7 @@ export const GeometrySettings: React.FC = () => {
|
||||
efficiencyLoss: '20'
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (organization?.id) {
|
||||
fetchTypes();
|
||||
}
|
||||
}, [organization?.id]);
|
||||
|
||||
const fetchTypes = async () => {
|
||||
const fetchTypes = React.useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const response = await geometryService.getAllTypes();
|
||||
@@ -36,7 +30,13 @@ export const GeometrySettings: React.FC = () => {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (appUser) {
|
||||
fetchTypes();
|
||||
}
|
||||
}, [appUser, fetchTypes]);
|
||||
|
||||
const handleOpenModal = (item?: GeometryType) => {
|
||||
if (item) {
|
||||
|
||||
Reference in New Issue
Block a user