Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Modal component, payment cancelling, processing errors in popovers and other improvements #62

Merged
merged 12 commits into from
Jul 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Changed endpoint for user handle suggestions.
  • Loading branch information
MadOPcode committed Jul 3, 2021
commit 9a4057cb2ef0276dc684755e821becbc81d8a0e9
21 changes: 12 additions & 9 deletions src/components/SearchHandleField/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@ const SearchHandleField = ({
setIsMenuFocused(false);
setIsMenuOpen(false);
setIsLoading(false);
setInputValue(option.value);
onChange(option.value);
}
} else if (action === "clear") {
isChangeAppliedRef.current = true;
setIsMenuFocused(false);
setIsMenuOpen(false);
setIsLoading(false);
setInputValue("");
onChange("");
}
};
Expand All @@ -128,7 +130,7 @@ const SearchHandleField = ({
const onKeyDown = (event) => {
const key = event.key;
if (key === "Enter" || key === "Escape") {
if (!isMenuFocused || isLoading) {
if (!isMenuFocused) {
isChangeAppliedRef.current = true;
setIsMenuFocused(false);
setIsMenuOpen(false);
Expand Down Expand Up @@ -159,14 +161,15 @@ const SearchHandleField = ({
const loadOptions = useCallback(
throttle(
async (value) => {
if (isChangeAppliedRef.current) {
return;
}
setIsLoading(true);
const options = await loadSuggestions(value);
if (!isChangeAppliedRef.current) {
setIsLoading(true);
const options = await loadSuggestions(value);
if (!isChangeAppliedRef.current) {
setOptions(options);
setIsLoading(false);
setIsMenuOpen(true);
}
setOptions(options);
setIsLoading(false);
setIsMenuOpen(true);
}
},
300,
Expand Down Expand Up @@ -227,7 +230,7 @@ const loadSuggestions = async (inputValue) => {
}
try {
const res = await getMemberSuggestions(inputValue);
const users = res.data.result.content.slice(0, 100);
const users = res.data.slice(0, 100);
let match = null;
for (let i = 0, len = users.length; i < len; i++) {
let value = users[i].handle;
Expand Down
2 changes: 1 addition & 1 deletion src/services/teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ import config from "../../config";
* @returns {Promise}
*/
export const getMemberSuggestions = (fragment) => {
return axios.get(`${config.API.V3}/members/_suggest/${fragment}`);
return axios.get(`${config.API.V5}/taas-teams/members-suggest/${fragment}`);
};