Bug fixes
This commit is contained in:
@@ -60,7 +60,7 @@ export function useMutationAPI() {
|
||||
</Text>
|
||||
),
|
||||
autoClose: false,
|
||||
withCloseButton: false,
|
||||
withCloseButton: true,
|
||||
icon: <VscLoading size={24} />,
|
||||
});
|
||||
const options: { method: string; headers: HeadersInit | undefined; body: string } = {
|
||||
@@ -73,44 +73,40 @@ export function useMutationAPI() {
|
||||
const responseData = await response.json();
|
||||
if (typeof responseData === 'object') {
|
||||
if (responseData.error.code === 'ER_DUP_ENTRY') {
|
||||
setTimeout(() => {
|
||||
notifications.update({
|
||||
id: id,
|
||||
loading: false,
|
||||
title: (
|
||||
<Text fw={600} c={'var(--mantine-color-accent-0)'}>
|
||||
{method} Failure!
|
||||
</Text>
|
||||
),
|
||||
message: (
|
||||
<Text c={'var(--mantine-color-primary-0)'}>
|
||||
Entry with that name already exists.
|
||||
</Text>
|
||||
),
|
||||
autoClose: 2500,
|
||||
icon: <FaCheck size={24} />,
|
||||
});
|
||||
}, 2500);
|
||||
notifications.update({
|
||||
id: id,
|
||||
loading: false,
|
||||
title: (
|
||||
<Text fw={600} c={'var(--mantine-color-accent-0)'}>
|
||||
{method} Failure!
|
||||
</Text>
|
||||
),
|
||||
message: (
|
||||
<Text c={'var(--mantine-color-primary-0)'}>
|
||||
Entry with that name already exists.
|
||||
</Text>
|
||||
),
|
||||
autoClose: 2500,
|
||||
icon: <FaCheck size={24} />,
|
||||
});
|
||||
}
|
||||
}
|
||||
return await responseData;
|
||||
}
|
||||
setTimeout(() => {
|
||||
notifications.update({
|
||||
id: id,
|
||||
loading: false,
|
||||
title: (
|
||||
<Text fw={600} c={'var(--mantine-color-accent-0)'}>
|
||||
{method} Success!
|
||||
</Text>
|
||||
),
|
||||
message: (
|
||||
<Text c={'var(--mantine-color-primary-0)'}>Called endpoint {endpoint}</Text>
|
||||
),
|
||||
autoClose: 2500,
|
||||
icon: <FaCheck size={24} />,
|
||||
});
|
||||
}, 2500);
|
||||
notifications.update({
|
||||
id: id,
|
||||
loading: false,
|
||||
title: (
|
||||
<Text fw={600} c={'var(--mantine-color-accent-0)'}>
|
||||
{method} Success!
|
||||
</Text>
|
||||
),
|
||||
message: (
|
||||
<Text c={'var(--mantine-color-primary-0)'}>Called endpoint {endpoint}</Text>
|
||||
),
|
||||
autoClose: 2500,
|
||||
icon: <FaCheck size={24} />,
|
||||
});
|
||||
return await response.json();
|
||||
};
|
||||
|
||||
@@ -249,42 +245,38 @@ export function useFileUploadAPI() {
|
||||
const responseData = await response.json();
|
||||
if (typeof responseData === 'object') {
|
||||
if (responseData.error.code === 'ER_DUP_ENTRY') {
|
||||
setTimeout(() => {
|
||||
notifications.update({
|
||||
id: id,
|
||||
loading: false,
|
||||
title: (
|
||||
<Text fw={600} c={'var(--mantine-color-accent-0)'}>
|
||||
{method} Failure!
|
||||
</Text>
|
||||
),
|
||||
message: (
|
||||
<Text c={'var(--mantine-color-primary-0)'}>
|
||||
Entry with that name already exists.
|
||||
</Text>
|
||||
),
|
||||
autoClose: 2500,
|
||||
icon: <FaCheck size={24} />,
|
||||
});
|
||||
}, 2500);
|
||||
notifications.update({
|
||||
id: id,
|
||||
loading: false,
|
||||
title: (
|
||||
<Text fw={600} c={'var(--mantine-color-accent-0)'}>
|
||||
{method} Failure!
|
||||
</Text>
|
||||
),
|
||||
message: (
|
||||
<Text c={'var(--mantine-color-primary-0)'}>
|
||||
Entry with that name already exists.
|
||||
</Text>
|
||||
),
|
||||
autoClose: 2500,
|
||||
icon: <FaCheck size={24} />,
|
||||
});
|
||||
}
|
||||
}
|
||||
return await responseData;
|
||||
}
|
||||
setTimeout(() => {
|
||||
notifications.update({
|
||||
id: id,
|
||||
loading: false,
|
||||
title: (
|
||||
<Text fw={600} c={'var(--mantine-color-accent-0)'}>
|
||||
{method} Success!
|
||||
</Text>
|
||||
),
|
||||
message: <Text c={'var(--mantine-color-primary-0)'}>{response.statusText}</Text>,
|
||||
autoClose: 2500,
|
||||
icon: <FaCheck size={24} />,
|
||||
});
|
||||
}, 2500);
|
||||
notifications.update({
|
||||
id: id,
|
||||
loading: false,
|
||||
title: (
|
||||
<Text fw={600} c={'var(--mantine-color-accent-0)'}>
|
||||
{method} Success!
|
||||
</Text>
|
||||
),
|
||||
message: <Text c={'var(--mantine-color-primary-0)'}>{response.statusText}</Text>,
|
||||
autoClose: 2500,
|
||||
icon: <FaCheck size={24} />,
|
||||
});
|
||||
return await response.json();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user