Skip to content

Commit

Permalink
feat: Add error-message
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed Nov 24, 2024
1 parent c138bf9 commit 7f22762
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/routes/htmx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,24 @@ app.post('/content-url', zValidator('json', ContentAddress), async (c) => {
'content-type': 'application/json',
},
});
const data = await resp.json();
if (resp.ok) {
const data = await resp.json();
return c.html(
<AppMessageBox title="OK!" type="link">
<p>Content URL is created!</p>
<p>
Link is{' '}
<a href={`/view/${data.slug}`} target="_blank" rel="noreferrer">
here
</a>
.
</p>
</AppMessageBox>,
);
}
return c.html(
<AppMessageBox title="OK!" type="link">
<p>Content URL is created!</p>
<p>
Link is{' '}
<a href={`/view/${data.slug}`} target="_blank" rel="noreferrer">
here
</a>
.
</p>
<AppMessageBox title="Error!" type="danger">
<p>{await resp.text()}</p>
</AppMessageBox>,
);
});
Expand Down

0 comments on commit 7f22762

Please sign in to comment.