Skip to content

Commit

Permalink
feat: adicionando a variavel 'requestQuery'.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gugahnstn committed Sep 21, 2023
1 parent 84c415b commit b3ee0f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/services/service-ip-api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
async function serviceIpApi(query?: string) {
const urlRequest = "https://jolly-leaf-26e7.gustavonstn.workers.dev/json/"+query+"?lang=pt-BR&fields=1061087"
import searchIp from "./search-ip";

async function serviceIpApi(query?: string | number) {
const requestQuery = !query ? searchIp() : query;

const urlRequest = "https://jolly-leaf-26e7.gustavonstn.workers.dev/json/"+requestQuery+"?lang=pt-BR&fields=1061087"

try {
const response = await fetch(urlRequest);
Expand Down

0 comments on commit b3ee0f1

Please sign in to comment.