Allow removing attachments
Show HTTP errors
This commit is contained in:
parent
334b1bc084
commit
18cac0345b
@ -26,7 +26,6 @@
|
||||
<link rel="stylesheet" href="/static/css/fa.css">
|
||||
<link rel="stylesheet" href="/static/css/font.css">
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
<link rel="stylesheet" href="/static/css/dtsel.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -39,12 +39,42 @@ export const Attachment = () => {
|
||||
}}
|
||||
></input>
|
||||
<span class="file-cta">
|
||||
<span class="file-label">{attachment_name || "Add Attachment"}</span>
|
||||
<span
|
||||
class="file-label"
|
||||
style={{
|
||||
maxWidth: "200px",
|
||||
}}
|
||||
>
|
||||
{attachment_name || "Add Attachment"}
|
||||
</span>
|
||||
<span class="file-icon">
|
||||
<i class="fas fa-upload"></i>
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
{attachment_name && (
|
||||
<>
|
||||
<button
|
||||
onClick={() => {
|
||||
setReminder((reminder) => ({
|
||||
...reminder,
|
||||
attachment: null,
|
||||
attachment_name: null,
|
||||
}));
|
||||
}}
|
||||
style={{
|
||||
border: "none",
|
||||
background: "none",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
>
|
||||
<span class="sr-only">Remove attachment</span>
|
||||
<span class="icon">
|
||||
<i class="fas fa-trash"></i>
|
||||
</span>
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -18,6 +18,12 @@ export const CreateButtonRow = () => {
|
||||
const queryClient = useQueryClient();
|
||||
const mutation = useMutation({
|
||||
...(guild ? postGuildReminder(guild) : postUserReminder()),
|
||||
onError: (error) => {
|
||||
flash({
|
||||
message: `An error occurred: ${error}`,
|
||||
type: "error",
|
||||
});
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
if (data.error) {
|
||||
flash({
|
||||
|
@ -19,6 +19,12 @@ export const EditButtonRow = () => {
|
||||
const flash = useFlash();
|
||||
const mutation = useMutation({
|
||||
...(guild ? patchGuildReminder(guild) : patchUserReminder()),
|
||||
onError: (error) => {
|
||||
flash({
|
||||
message: `An error occurred: ${error}`,
|
||||
type: "error",
|
||||
});
|
||||
},
|
||||
onSuccess: (response) => {
|
||||
if (guild) {
|
||||
queryClient.invalidateQueries({
|
||||
|
Loading…
Reference in New Issue
Block a user