Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task-27] Set up API call to fetch users Part 2 #51

Merged
merged 4 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ react native front end app for tally application
- Make sure you have an emulator running (Android Studio > AVD > Select play on a device)
- `npm run ios`: start ios app
- `npm run web`: start web app

## local dev with server

To run with the server, make sure you have tally-backend setup and running (`npm run start-dev`). The server needs to be up and running
prior to making API calls.
29 changes: 29 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"dependencies": {
"@babel/preset-typescript": "^7.16.7",
"@expo/webpack-config": "^18.0.1",
"axios": "^1.4.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk if there's a preference of how to make the API call? or if y'all preference a different library - open to testing!

"expo": "~48.0.18",
"expo-status-bar": "~1.4.4",
"prop-types": "^15.8.1",
Expand Down
10 changes: 10 additions & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import axios from "axios";

const getUsers = async () => {
const { data } = await axios.get('http://localhost:8080/api/users')
return data;
}

export default {
getUsers
}