Skip to content

Commit

Permalink
fix(buildteams): 🐛 Loading state display on image editing
Browse files Browse the repository at this point in the history
  • Loading branch information
Nudelsuppe42 committed Nov 3, 2023
1 parent 548b5f8 commit 8b7c7fc
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions src/pages/teams/[team]/manage/images.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,32 @@ const Settings = () => {
color: 'yellow',
}),
onConfirm: () => {
fetch(process.env.NEXT_PUBLIC_API_URL + `/buildteams/${router.query.team}/showcases/${image.id}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + user.token,
},
})
.then((res) => res.json())
.then((res) => {
if (res.errors) {
showNotification({
title: 'Update failed',
message: res.error,
color: 'red',
});
} else {
showNotification({
title: 'Showcase Image removed',
message: 'All Data has been saved',
color: 'green',
});
mutate(`/buildteams/${router.query.team}/showcases`);
}
});
setLoading(true);
fetch(process.env.NEXT_PUBLIC_API_URL + `/buildteams/${router.query.team}/showcases/${image.id}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + user.token,
},
})
.then((res) => res.json())
.then((res) => {
setLoading(false);
if (res.errors) {
showNotification({
title: 'Update failed',
message: res.error,
color: 'red',
});
} else {
showNotification({
title: 'Showcase Image removed',
message: 'All Data has been saved',
color: 'green',
});
mutate(`/buildteams/${router.query.team}/showcases`);
}
});
},
});
};
Expand Down Expand Up @@ -142,7 +144,7 @@ const Settings = () => {
>
<SettingsTabs team={router.query.team?.toString() || ''} loading={!data || loading}>
<Table.ScrollContainer minWidth={800}>
<Button leftSection={<IconPlus />} onClick={() => handleAddImage()} mb="md">
<Button leftSection={<IconPlus />} onClick={() => handleAddImage()} mb="md" loading={loading}>
Add Showcase Image
</Button>
<Table verticalSpacing="sm">
Expand Down

0 comments on commit 8b7c7fc

Please sign in to comment.