logout and info
This commit is contained in:
1 parent
4041d9827d
commit
7ea2c37116
9 files changed
+49
-34
No files matched your search
@@ -37,28 +37,28 @@ const User = () => {
|
||||
const [title, setTitle] = useState('');
|
||||
const [username, setUsername] = useState('');
|
||||
const [results, setResults] = useState([]);
|
||||
const [noResults, setNoResults] = useState(false);
|
||||
const [infoText, setInfoText] = useState('');
|
||||
|
||||
async function fetchResults() {
|
||||
const [error, results] = await actions.postWantSearch(artist, title);
|
||||
|
||||
if (results.length === 0) {
|
||||
setResults([]);
|
||||
return setNoResults(true);
|
||||
return setInfoText('No results');
|
||||
}
|
||||
|
||||
setNoResults(false);
|
||||
setInfoText('');
|
||||
setResults(results);
|
||||
}
|
||||
|
||||
async function submitWantlist() {
|
||||
const [error, wants] = await actions.postDiscogs(username);
|
||||
if (results.length === 0) {
|
||||
if (wants.length === 0) {
|
||||
setResults([]);
|
||||
return setNoResults(true);
|
||||
return setInfoText('No new additions');
|
||||
}
|
||||
|
||||
console.log('synced', wants.length, 'wants');
|
||||
setInfoText(`Added ${wants.length} items to your list.`);
|
||||
}
|
||||
|
||||
const searchRef = useRef<HTMLInputElement>()
|
||||
@@ -81,8 +81,8 @@ const User = () => {
|
||||
? <button onClick={() => window.scrollTo(0, 0)}> top </button>
|
||||
: null;
|
||||
|
||||
const noResultsEl = noResults
|
||||
? <article>No Results</article>
|
||||
const infoEl = infoText
|
||||
? <article><div></div><div>{infoText}</div></article>
|
||||
: null;
|
||||
|
||||
return (
|
||||
@@ -108,7 +108,7 @@ const User = () => {
|
||||
</div>
|
||||
<div />
|
||||
<div>
|
||||
{noResultsEl}
|
||||
{infoEl}
|
||||
{results.map(Result)}
|
||||
{topEl}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user