Skip to content

Commit

Permalink
feat: configure client axios
Browse files Browse the repository at this point in the history
  • Loading branch information
robsonnatanael committed Apr 3, 2022
1 parent 36afbbd commit 4d99bf9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .eslintcache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/index.tsx":"1","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/App.tsx":"2","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/styles/global.ts":"3","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/index.tsx":"4","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/styles.ts":"5","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/index.tsx":"6","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/styles.ts":"7","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/index.tsx":"8","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/styles.ts":"9","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/index.tsx":"10","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/styles.ts":"11"},{"size":556,"mtime":1648952246282,"results":"12","hashOfConfig":"13"},{"size":262,"mtime":1648938300862,"results":"14","hashOfConfig":"13"},{"size":909,"mtime":1648944108002,"results":"15","hashOfConfig":"13"},{"size":324,"mtime":1648779011418,"results":"16","hashOfConfig":"13"},{"size":543,"mtime":1648943023772,"results":"17","hashOfConfig":"13"},{"size":263,"mtime":1648947003732,"results":"18","hashOfConfig":"13"},{"size":145,"mtime":1648937924902,"results":"19","hashOfConfig":"13"},{"size":800,"mtime":1648943380912,"results":"20","hashOfConfig":"13"},{"size":632,"mtime":1648943356142,"results":"21","hashOfConfig":"13"},{"size":958,"mtime":1648951755392,"results":"22","hashOfConfig":"13"},{"size":638,"mtime":1648948051382,"results":"23","hashOfConfig":"13"},{"filePath":"24","messages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"16wifw6",{"filePath":"26","messages":"27","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"33","messages":"34","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"35","messages":"36","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"37","messages":"38","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"39","messages":"40","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"41","messages":"42","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"43","messages":"44","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"45","messages":"46","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/App.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/styles/global.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/index.tsx",[],["47","48"],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/styles.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/styles.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/styles.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/styles.ts",[],{"ruleId":"49","replacedBy":"50"},{"ruleId":"51","replacedBy":"52"},"no-native-reassign",["53"],"no-negated-in-lhs",["54"],"no-global-assign","no-unsafe-negation"]
[{"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/index.tsx":"1","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/App.tsx":"2","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/styles/global.ts":"3","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/index.tsx":"4","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/styles.ts":"5","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/index.tsx":"6","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/styles.ts":"7","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/index.tsx":"8","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/styles.ts":"9","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/index.tsx":"10","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/styles.ts":"11","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/services/api.ts":"12"},{"size":556,"mtime":1648952246282,"results":"13","hashOfConfig":"14"},{"size":262,"mtime":1648938300862,"results":"15","hashOfConfig":"14"},{"size":909,"mtime":1648944108002,"results":"16","hashOfConfig":"14"},{"size":324,"mtime":1648779011418,"results":"17","hashOfConfig":"14"},{"size":543,"mtime":1648943023772,"results":"18","hashOfConfig":"14"},{"size":263,"mtime":1648947003732,"results":"19","hashOfConfig":"14"},{"size":145,"mtime":1648937924902,"results":"20","hashOfConfig":"14"},{"size":800,"mtime":1648943380912,"results":"21","hashOfConfig":"14"},{"size":632,"mtime":1648943356142,"results":"22","hashOfConfig":"14"},{"size":948,"mtime":1648953717462,"results":"23","hashOfConfig":"14"},{"size":638,"mtime":1648948051382,"results":"24","hashOfConfig":"14"},{"size":106,"mtime":1648953563212,"results":"25","hashOfConfig":"14"},{"filePath":"26","messages":"27","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"16wifw6",{"filePath":"28","messages":"29","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"33","messages":"34","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"35","messages":"36","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"37","messages":"38","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"39","messages":"40","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"41","messages":"42","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"43","messages":"44","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"45","messages":"46","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"47","messages":"48","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"49","messages":"50","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/App.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/styles/global.ts",[],["51","52"],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/styles.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/styles.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/styles.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/styles.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/services/api.ts",[],{"ruleId":"53","replacedBy":"54"},{"ruleId":"55","replacedBy":"56"},"no-native-reassign",["57"],"no-negated-in-lhs",["58"],"no-global-assign","no-unsafe-negation"]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.26.1",
"miragejs": "^0.1.43",
"react": "^17.0.1",
"react-dom": "^17.0.1",
Expand Down
6 changes: 3 additions & 3 deletions src/components/TransactionsTable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useEffect } from "react";
import { api } from "../../services/api";
import { Container } from "./styles";

export function TransactionsTable() {
useEffect(() => {
fetch('http://localhost:3000/api/transactions')
.then(response => response.json())
.then(data => console.log(data))
api.get('transactions')
.then(response => console.log(response.data))
}, [])

return (
Expand Down
5 changes: 5 additions & 0 deletions src/services/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import axios from "axios";

export const api = axios.create({
baseURL: "http://localhost:3000/api",
});
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,13 @@ axe-core@^4.3.5:
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.4.1.tgz#7dbdc25989298f9ad006645cd396782443757413"
integrity sha512-gd1kmb21kwNuWr6BQz8fv6GNECPBnUasepcoLbekws23NVBLODdsClRZ+bQ8+9Uomf3Sm3+Vwn0oYG9NvwnJCw==

axios@^0.26.1:
version "0.26.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9"
integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==
dependencies:
follow-redirects "^1.14.8"

axobject-query@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
Expand Down Expand Up @@ -5133,7 +5140,7 @@ flush-write-stream@^1.0.0:
inherits "^2.0.3"
readable-stream "^2.3.6"

follow-redirects@^1.0.0:
follow-redirects@^1.0.0, follow-redirects@^1.14.8:
version "1.14.9"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==
Expand Down

0 comments on commit 4d99bf9

Please sign in to comment.