diff options
author | 2023-01-25 09:47:55 +0100 | |
---|---|---|
committer | 2023-01-25 09:47:55 +0100 | |
commit | 27d4e364e04c65a11c2855eaa9a1ffc55eb23239 (patch) | |
tree | bbdde6654b6f33278ae378b7dd0345a1edc55a2e /web/source/settings/admin/emoji/local/overview.js | |
parent | [chore] remove funky duplicate attachment in testrig (#1379) (diff) | |
download | gotosocial-27d4e364e04c65a11c2855eaa9a1ffc55eb23239.tar.xz |
[chore] Settings refactor fix4 (#1383)
* fix error handling behavior in emoji overview and FormWithData components
* css: long domain cutoff
* unused require
* eslint vscode task
Diffstat (limited to 'web/source/settings/admin/emoji/local/overview.js')
-rw-r--r-- | web/source/settings/admin/emoji/local/overview.js | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/web/source/settings/admin/emoji/local/overview.js b/web/source/settings/admin/emoji/local/overview.js index 78546b2fa..f8f61cea1 100644 --- a/web/source/settings/admin/emoji/local/overview.js +++ b/web/source/settings/admin/emoji/local/overview.js @@ -26,27 +26,35 @@ const NewEmojiForm = require("./new-emoji"); const query = require("../../../lib/query"); const { useEmojiByCategory } = require("../category-select"); const Loading = require("../../../components/loading"); +const { Error } = require("../../../components/error"); module.exports = function EmojiOverview({ baseUrl }) { const { data: emoji = [], isLoading, + isError, error } = query.useListEmojiQuery({ filter: "domain:local" }); + let content = null; + + if (isLoading) { + content = <Loading />; + } else if (isError) { + content = <Error error={error} />; + } else { + content = ( + <> + <EmojiList emoji={emoji} baseUrl={baseUrl} /> + <NewEmojiForm emoji={emoji} /> + </> + ); + } + return ( <> <h1>Custom Emoji (local)</h1> - {error && - <div className="error accent">{error}</div> - } - {isLoading - ? <Loading /> - : <> - <EmojiList emoji={emoji} baseUrl={baseUrl} /> - <NewEmojiForm emoji={emoji} /> - </> - } + {content} </> ); }; |