mirror of
https://github.com/balzack/databag.git
synced 2025-04-23 01:55:17 +00:00
avoid request till server stet
This commit is contained in:
parent
5d482d7f3c
commit
38098ccef7
@ -55,8 +55,6 @@ export function Access() {
|
||||
}
|
||||
};
|
||||
|
||||
console.log(Platform.OS);
|
||||
|
||||
return (
|
||||
<View style={styles.split}>
|
||||
{state.wide && (
|
||||
|
@ -44,8 +44,13 @@ export function useAccess() {
|
||||
clearTimeout(debounceAvailable.current);
|
||||
debounceAvailable.current = setTimeout(async () => {
|
||||
try {
|
||||
const available = await app.actions.getAvailable(node, secure);
|
||||
updateState({available});
|
||||
if (node) {
|
||||
const available = await app.actions.getAvailable(node, secure);
|
||||
updateState({available});
|
||||
}
|
||||
else {
|
||||
updateState({available: 0});
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
updateState({available: 0});
|
||||
@ -63,13 +68,18 @@ export function useAccess() {
|
||||
clearTimeout(debounceTaken.current);
|
||||
debounceTaken.current = setTimeout(async () => {
|
||||
try {
|
||||
const available = await app.actions.getUsername(
|
||||
username,
|
||||
token,
|
||||
node,
|
||||
secure,
|
||||
);
|
||||
updateState({taken: !available});
|
||||
if (node && username) {
|
||||
const available = await app.actions.getUsername(
|
||||
username,
|
||||
token,
|
||||
node,
|
||||
secure,
|
||||
);
|
||||
updateState({taken: !available});
|
||||
}
|
||||
else {
|
||||
updateState({ taken: false });
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
updateState({taken: false});
|
||||
|
7621
app/sdk/yarn.lock
7621
app/sdk/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user