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/fa.css">
|
||||||
<link rel="stylesheet" href="/static/css/font.css">
|
<link rel="stylesheet" href="/static/css/font.css">
|
||||||
<link rel="stylesheet" href="/static/css/style.css">
|
<link rel="stylesheet" href="/static/css/style.css">
|
||||||
<link rel="stylesheet" href="/static/css/dtsel.css">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
@ -39,12 +39,42 @@ export const Attachment = () => {
|
|||||||
}}
|
}}
|
||||||
></input>
|
></input>
|
||||||
<span class="file-cta">
|
<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">
|
<span class="file-icon">
|
||||||
<i class="fas fa-upload"></i>
|
<i class="fas fa-upload"></i>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</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>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -18,6 +18,12 @@ export const CreateButtonRow = () => {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const mutation = useMutation({
|
const mutation = useMutation({
|
||||||
...(guild ? postGuildReminder(guild) : postUserReminder()),
|
...(guild ? postGuildReminder(guild) : postUserReminder()),
|
||||||
|
onError: (error) => {
|
||||||
|
flash({
|
||||||
|
message: `An error occurred: ${error}`,
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
},
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
flash({
|
flash({
|
||||||
|
@ -19,6 +19,12 @@ export const EditButtonRow = () => {
|
|||||||
const flash = useFlash();
|
const flash = useFlash();
|
||||||
const mutation = useMutation({
|
const mutation = useMutation({
|
||||||
...(guild ? patchGuildReminder(guild) : patchUserReminder()),
|
...(guild ? patchGuildReminder(guild) : patchUserReminder()),
|
||||||
|
onError: (error) => {
|
||||||
|
flash({
|
||||||
|
message: `An error occurred: ${error}`,
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
},
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
if (guild) {
|
if (guild) {
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
|
Loading…
Reference in New Issue
Block a user