unistore wip
This commit is contained in:
1 parent
a43d4f32e4
commit
cf01670ee6
17 files changed
+253
-79
No files matched your search
@@ -2,13 +2,13 @@ import { h } from 'preact';
|
||||
import { useState, useRef, useEffect } from 'preact/hooks';
|
||||
import { ExternalLink, Check } from 'react-feather';
|
||||
|
||||
import actions from '../actions';
|
||||
import http from '../http';
|
||||
|
||||
function Result(r) {
|
||||
const [added, setAdded] = useState(false)
|
||||
|
||||
async function onClick() {
|
||||
const [error, want] = await actions.postWant(r.id);
|
||||
const [error, want] = await http.postWant(r.id);
|
||||
if (error) return false;
|
||||
setAdded(true);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ const User = () => {
|
||||
const [infoText, setInfoText] = useState('');
|
||||
|
||||
async function fetchResults() {
|
||||
const [error, results] = await actions.postWantSearch(artist, title);
|
||||
const [error, results] = await http.postWantSearch(artist, title);
|
||||
|
||||
if (results.length === 0) {
|
||||
setResults([]);
|
||||
@@ -52,7 +52,7 @@ const User = () => {
|
||||
}
|
||||
|
||||
async function submitWantlist() {
|
||||
const [error, wants] = await actions.postDiscogs(username);
|
||||
const [error, wants] = await http.postDiscogs(username);
|
||||
if (wants.length === 0) {
|
||||
setResults([]);
|
||||
return setInfoText('No new additions');
|
||||
|
||||
Reference in new issue
Block a user