This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this function assumes that the target is a DOM element | |
function classToggle(element, name) { | |
var target = element.target; | |
var classEx = new RegExp(" " + name + "|" + name + " ", "g"); | |
if (target.classList) { | |
// there's support for the class list API | |
if (target.classList.contains(name)) { | |
target.classList.remove(name); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { gql } from "@apollo/client"; | |
export const ALL_USERS = gql` | |
query AllUsers ($searchUserInput: SearchUserInput) { | |
allUsers (input: $searchUserInput) { | |
id | |
name | |
} | |
} | |
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Users = () => { | |
const [users, setUsers] = useState([]); | |
const [nameSearch, setSearchUserInput] = useState("ad"); | |
const [userTypeFilter, setUserTypeFilter] = useState("all"); | |
const [fetchUsers, { loading, error, data }] = useLazyQuery(ALL_USERS, { | |
variables: { | |
input: { | |
name: nameSearch, | |
userType: userTypeFilter | |
} |
OlderNewer