feat: prettier
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { modals } from "@mantine/modals";
|
||||
import { ServiceCategorySchema, ServiceSchema, ServiceService } from "../../../client";
|
||||
import {
|
||||
ServiceCategorySchema,
|
||||
ServiceSchema,
|
||||
ServiceService,
|
||||
} from "../../../client";
|
||||
import { notifications } from "../../../shared/lib/notifications.ts";
|
||||
import useServicesList from "./useServicesList.tsx";
|
||||
import { Text } from "@mantine/core";
|
||||
@@ -18,12 +22,13 @@ const useServicesState = () => {
|
||||
});
|
||||
};
|
||||
const onCreate = (values: ServiceSchema) => {
|
||||
ServiceService.createService({ requestBody: { service: values } })
|
||||
.then(async ({ ok, message }) => {
|
||||
ServiceService.createService({ requestBody: { service: values } }).then(
|
||||
async ({ ok, message }) => {
|
||||
notifications.guess(ok, { message: message });
|
||||
if (!ok) return;
|
||||
await refetch();
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const onCreateCategoryClick = () => {
|
||||
@@ -37,24 +42,29 @@ const useServicesState = () => {
|
||||
});
|
||||
};
|
||||
const onCategoryCreate = (category: ServiceCategorySchema) => {
|
||||
ServiceService.createServiceCategory({ requestBody: { category: category } })
|
||||
.then(({ ok, message }) =>
|
||||
notifications.guess(ok, { message: message }));
|
||||
ServiceService.createServiceCategory({
|
||||
requestBody: { category: category },
|
||||
}).then(({ ok, message }) =>
|
||||
notifications.guess(ok, { message: message })
|
||||
);
|
||||
};
|
||||
|
||||
const onServiceDelete = (service: ServiceSchema) => {
|
||||
modals.openConfirmModal({
|
||||
title: "Удаление услуги",
|
||||
children: (<Text>
|
||||
Вы уверены, что хотите удалить услугу "{service.name}"?
|
||||
</Text>),
|
||||
children: (
|
||||
<Text>
|
||||
Вы уверены, что хотите удалить услугу "{service.name}"?
|
||||
</Text>
|
||||
),
|
||||
onConfirm: () => {
|
||||
ServiceService.deleteService({ requestBody: { serviceId: service.id } })
|
||||
.then(async ({ ok, message }) => {
|
||||
notifications.guess(ok, { message: message });
|
||||
if (!ok) return;
|
||||
await refetch();
|
||||
});
|
||||
ServiceService.deleteService({
|
||||
requestBody: { serviceId: service.id },
|
||||
}).then(async ({ ok, message }) => {
|
||||
notifications.guess(ok, { message: message });
|
||||
if (!ok) return;
|
||||
await refetch();
|
||||
});
|
||||
},
|
||||
labels: {
|
||||
confirm: "Удалить",
|
||||
@@ -64,17 +74,15 @@ const useServicesState = () => {
|
||||
};
|
||||
|
||||
const onServiceUpdate = (service: ServiceSchema) => {
|
||||
ServiceService
|
||||
.updateService({
|
||||
requestBody: {
|
||||
data: service,
|
||||
},
|
||||
})
|
||||
.then(async ({ ok, message }) => {
|
||||
notifications.guess(ok, { message: message });
|
||||
if (!ok) return;
|
||||
await refetch();
|
||||
});
|
||||
ServiceService.updateService({
|
||||
requestBody: {
|
||||
data: service,
|
||||
},
|
||||
}).then(async ({ ok, message }) => {
|
||||
notifications.guess(ok, { message: message });
|
||||
if (!ok) return;
|
||||
await refetch();
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -86,4 +94,4 @@ const useServicesState = () => {
|
||||
};
|
||||
};
|
||||
|
||||
export default useServicesState;
|
||||
export default useServicesState;
|
||||
|
||||
Reference in New Issue
Block a user