refactor: remove unnecessary async suffix from attribute functions

This commit is contained in:
tekh 2025-07-10 12:09:25 +02:00
parent a5e32d0d39
commit 9a819d1bd6
3 changed files with 6 additions and 6 deletions

View File

@ -22,11 +22,11 @@ export type Filter = AttributeCreateDto & {
id: number;
};
export function getAttributesAsync(): Promise<Filter[]> {
export function getAttributes(): Promise<Filter[]> {
return Promise.resolve(_filters);
}
export function createAttributesAsync(filter: AttributeCreateDto): Promise<Filter> {
export function createAttributes(filter: AttributeCreateDto): Promise<Filter> {
const newFilter: Filter = {
...filter,
id: _filters.length + 1

View File

@ -8,7 +8,7 @@ import Autocomplete from '@mui/material/Autocomplete';
import { Iconify } from 'src/components/iconify/iconify';
import { createAttributesAsync, filterTypes, Type } from '../../../api/attribute-service';
import { createAttributes, filterTypes, Type } from '../../../api/attribute-service';
const style = {
position: 'absolute',
@ -46,7 +46,7 @@ export default function CreateFilterModal({ open, handleClose }: ModalProps) {
alert('No type.');
}
else {
await createAttributesAsync({ name: name, type: selectedType, label: label }).then(closeReset);
await createAttributes({ name: name, type: selectedType, label: label }).then(closeReset);
}
}

View File

@ -8,7 +8,7 @@ import Pagination from '@mui/material/Pagination';
import { Doc } from 'src/api/document-service';
import { DashboardContent } from 'src/layouts/dashboard';
import { Filter, getAttributesAsync } from 'src/api/attribute-service';
import { Filter, getAttributes } from 'src/api/attribute-service';
import { Iconify } from 'src/components/iconify';
@ -34,7 +34,7 @@ export function DocSearchView({ docs }: Props) {
}, []);
useEffect(() => {
getAttributesAsync().then((res) => {
getAttributes().then((res) => {
setFilters(res);
});
}, []);