-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
449e37a
commit 03f5730
Showing
13 changed files
with
127 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
|
||
declare interface Sample { | ||
declare interface JoinUserInputType { | ||
id: string; | ||
name: string; | ||
joinDate: string; | ||
} | ||
|
||
declare interface LoginOutputType { | ||
id: string; | ||
name: string; | ||
joinDate: string; | ||
accessToken: string; | ||
refreshToken?: string; | ||
} | ||
|
||
declare interface UserLoginType { | ||
accessToken: string; | ||
refreshToken?: string; | ||
} | ||
|
||
// declare 사용하여 전역화 시킨다. |
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
src/Components/Common/Modal/Modal.css → src/Components/Modal/Modal.css
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
This file contains 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
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,38 @@ | ||
import { QueryClient, useMutation, useQuery } from "@tanstack/react-query"; | ||
import { getLogin, postUserJoin } from "../Api/api.ts"; | ||
|
||
// react- query 커스텀 훅 | ||
|
||
// react- query 커스텀 훅 | ||
const queryClient = new QueryClient() | ||
|
||
|
||
export default function useDataQuery(accessToken:string) { | ||
|
||
const getUserData = | ||
useQuery(["useData", accessToken], () => { | ||
if (accessToken) { | ||
return getLogin(accessToken).then((res) => { | ||
console.log(res); | ||
return res; | ||
}); | ||
} else { | ||
return []; | ||
} | ||
}, { staleTime: 1000 * 60 }); | ||
|
||
const joinUser = | ||
useMutation((joinData: JoinUserInputType ) => postUserJoin(joinData), { | ||
onSuccess: () => { | ||
queryClient.invalidateQueries(["useData", accessToken]); | ||
} | ||
}); | ||
|
||
return { joinUser, getUserData }; | ||
} | ||
|
||
|
||
/* | ||
1. provider 설정 | ||
2. useQuery 설정 | ||
3. 필요한 곳에서 action 실행(Mutation) | ||
*/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
import App from './App.tsx' | ||
import './index.css' | ||
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
import App from "./App.tsx"; | ||
import "./index.css"; | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
|
||
const queryClient = new QueryClient() | ||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( | ||
const queryClient = new QueryClient(); | ||
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( | ||
<React.StrictMode> | ||
<QueryClientProvider client={queryClient}> | ||
<App /> | ||
</QueryClientProvider> | ||
</React.StrictMode>, | ||
) | ||
<BrowserRouter> | ||
<QueryClientProvider client={queryClient}> | ||
<App /> | ||
</QueryClientProvider> | ||
</BrowserRouter> | ||
</React.StrictMode> | ||
); |
This file contains 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
This file contains 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