Fixed error/url not showing properly (#85)
* Fixed error not showing. * Update Upload.tsx
This commit is contained in:
parent
dacf13e46d
commit
474024ea55
1 changed files with 4 additions and 5 deletions
|
@ -30,13 +30,12 @@ export default function Manage({ route }) {
|
|||
},
|
||||
body
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
const json = await res.json();
|
||||
if (res.ok && json.error === undefined) {
|
||||
setOpen(true);
|
||||
setSeverity('success');
|
||||
setMessage(`File uploaded! ${window.location.protocol}//${window.location.host}${route}/${await res.text()}`);
|
||||
setMessage(`File uploaded! ${json.url}`);
|
||||
} else {
|
||||
const json = await res.json();
|
||||
setOpen(true);
|
||||
setSeverity('error');
|
||||
setMessage('Could not upload file: ' + json.error);
|
||||
|
@ -86,4 +85,4 @@ export default function Manage({ route }) {
|
|||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue