Moved to https://github.com/VitorLuizC/brazilian-values.
This file contains hidden or 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
| /** | |
| * Obtém os cabeçalhos da requisição. | |
| * @returns {Object.<string, string>} | |
| */ | |
| export const getHeaders = () => { | |
| const token = localStorage.getItem('access_token'); | |
| const headers = { | |
| 'Content-Type': 'application/json', | |
| ...token && { 'Authorization': `Bearer ${token}` } | |
| }; |
This file contains hidden or 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 BLOCK = /\{[\w|\_|\s|\:|\!|\(|\)|\$]*\}/ | |
| /** | |
| * Get GraphQL block. | |
| * @param {string} [source] | |
| * @returns {string} | |
| */ | |
| const getBlocks = (source = '') => { | |
| const { '0': block, index } = BLOCK.exec(source) || {} | |
| if (!block) |
This file contains hidden or 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
| query SearchUsers ($term: String!, $type: SearchUsersType!) { | |
| users: searchUsers (term: $term, type: $type) { | |
| id | |
| name | |
| position | |
| } | |
| } |
This file contains hidden or 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
| query GetSearchUsersTypes { | |
| enum: __type (name: "SearchUsersTypes") { | |
| values: enumValues { | |
| value: name | |
| label: description | |
| } | |
| } | |
| } |
This file contains hidden or 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
| <template> | |
| <v-form> | |
| <v-text-field v-model="term" label="Pesquisar usuário" /> | |
| <v-select v-model="type" :items="types" label="Pesquisar por" /> | |
| <v-btn @click="submit()">Pesquisar</v-btn> | |
| </v-form> | |
| </template> | |
| <script> | |
| export default { |
This file contains hidden or 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
| <template> | |
| <section> | |
| <search-users-form :types="types" @search="search($event)" /> | |
| <v-data-table | |
| :items="users" | |
| :headers="[ | |
| { text: 'ID', value: 'id' }, | |
| { text: 'Nome', value: 'name' }, | |
| { text: 'E-Mail', value: 'email' }, | |
| { text: 'Cargo', value: 'position' } |
This file contains hidden or 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 request from './request'; | |
| import SearchUsers from './SearchUsers.graphql'; | |
| import GetSearchUsersTypes from './GetSearchUsersTypes.graphql'; | |
| /** | |
| * Obtém os tipos de pesquisa a partir do enum "SearchUserTypes". | |
| * @returns {Promise.<{ value: string, label: string }[]>} | |
| */ | |
| export const getTypes = async () => { | |
| const response = await request(GetSearchUsersTypes); |
This file contains hidden or 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 reconstruct from 'reconstruct' | |
| // const isValidDescription = (value) => { | |
| // // TODO: Não pode repetir. | |
| // // TODO: Não pode ter valores diferentes de string. | |
| // // Can't correspond 1 to N properties. | |
| // // Ex. { 'name': 'user.name', 'fullName': 'user.name' } | |
| // } | |
| const inverse = (value, property) => ({ [value]: property }) |
-
lodash.geté uma função do Lodash para obter o valor de um objeto a partir de um path. -
lodash.seté uma função do Lodash para definir um valor para um objeto a partir de um path. -
object-pathfaz o mesmo que as funções do Lodash, mas num único módulo. -
objectpathcompila um object path para um array.