Skip to content

Commit

Permalink
Setup project structure and react query
Browse files Browse the repository at this point in the history
  • Loading branch information
developedBySJ committed Jun 20, 2022
1 parent 7d4d795 commit 3fe938b
Show file tree
Hide file tree
Showing 11 changed files with 198 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules
dist
node_modules
dist
14 changes: 7 additions & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
140 changes: 140 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 @@ -10,6 +10,7 @@
"format": "prettier --write src/**/*.{ts,tsx}"
},
"dependencies": {
"axios": "^0.27.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-query": "^3.39.1",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Care Dashboard
Care Dashboard
---
12 changes: 9 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { BrowserRouter, Route, Routes } from 'react-router-dom'
import { QueryClient, QueryClientProvider } from 'react-query'

import { routes } from './router'

const queryClient = new QueryClient()

function App() {
return (
<Routes>
Expand All @@ -14,8 +18,10 @@ function App() {
// eslint-disable-next-line react/display-name
export default () => {
return (
<BrowserRouter>
<App />
</BrowserRouter>
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<App />
</BrowserRouter>
</QueryClientProvider>
)
}
23 changes: 23 additions & 0 deletions src/api/mutation/useCreateExample.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import axios from 'axios'
import { useMutation, useQuery } from 'react-query'

export type CreateExamplePaylaod = {
some: string
}

export type CreateExampleResponse = {
success: boolean
}

export const CREATE_EXAMPLE_KEY = 'create_example_key'

export const useCreateExample = () => {
return useMutation<
CreateExampleResponse,
unknown,
CreateExamplePaylaod,
unknown
>(CREATE_EXAMPLE_KEY, (payload) =>
axios.post('https://example.com/example', payload)
)
}
8 changes: 8 additions & 0 deletions src/api/queries/useGetItems.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import axios from 'axios'
import { useQuery } from 'react-query'

export const GET_ITEMS_KEY = 'getItems'

export const useGetItems = () => {
useQuery(GET_ITEMS_KEY, () => axios.get('https://example.com/feedbacks'))
}
5 changes: 5 additions & 0 deletions src/components/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react'

export const SideBar = () => {
return <div>SideBar</div>
}
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type example = string
1 change: 1 addition & 0 deletions src/utils/example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const add = (a: number, b: number) => a + b

1 comment on commit 3fe938b

@vercel
Copy link

@vercel vercel bot commented on 3fe938b Jun 27, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.