Skip to content

Commit

Permalink
Revert "Add. 소셜 로그인 구현"
Browse files Browse the repository at this point in the history
This reverts commit e4f77a8.
  • Loading branch information
jee-eun-k committed Feb 1, 2024
1 parent e4f77a8 commit cd63938
Show file tree
Hide file tree
Showing 15 changed files with 314 additions and 641 deletions.
7 changes: 0 additions & 7 deletions .vscode/settings.json

This file was deleted.

42 changes: 3 additions & 39 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"react-app-polyfill": "^3.0.0",
"react-chartjs-2": "^5.1.0",
"react-color": "^2.19.3",
"react-cookie": "^7.0.2",
"react-countdown": "^2.3.5",
"react-dev-utils": "^12.0.1",
"react-dom": "^18.2.0",
Expand Down
77 changes: 23 additions & 54 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,66 +22,35 @@ import ResetPWMode from './pages/auth/resetPW/ResetPWMode';
import ResetPWStep from './pages/auth/resetPW/ResetPWSteps';
import AccountSetting from './pages/settings/AccountSetting';
import PopupMessage from './components/common/PopupMessage';
import LoginRedirect from './pages/auth/login/LoginRedirect';
import { CookiesProvider } from 'react-cookie';

function App() {
return (
<BrowserRouter>
<ThemeProvider theme={theme}>
<CookiesProvider>
<Box
sx={{ display: 'flex', flexDirection: 'column', height: '100vh' }}
>
<Box sx={{ height: '94vh' }}>
<Routes>
<Route path="/" element={<Navigate to="/login" />} />
<Route path="/login" element={<Login />} />
<Route path="/signin/redirect" element={<LoginRedirect />} />
<Route path="/signUp" element={<SignUp />} />
<Route path="/findID" element={<FindID />} />

<Route path="/resetPW" element={<ResetPWStep />} />
<Route path="/resetPWMode" element={<ResetPWMode />} />

<Route
path="/record"
element={
<>
<RecordPage />
<BottomNav />
</>
}
/>
<Route
path="/statistics"
element={
<>
<StatisticsPage />
<BottomNav />
</>
}
/>
<Route
path="/settings"
element={
<>
<SettingsPage />
<BottomNav />
</>
}
/>
<Route path="/settings/account" element={<AccountSetting />} />

<Route path="/record/edit" element={<EditRecordPage />} />
<Route path="/category" element={<CategoryPage />} />
<Route path="/category/edit" element={<EditCategoryPage />} />
</Routes>
</Box>
<Box sx={{display: 'flex', flexDirection: 'column', height: '100vh'}}>
<Box sx={{height: '94vh'}}>
<Routes>
<Route path="/" element={<Navigate to="/login" />} />
<Route path="/login" element={<Login />} />
<Route path="/signUp" element={<SignUp />} />
<Route path="/findID" element={<FindID />} />

<Route path="/resetPW" element={<ResetPWStep />} />
<Route path="/resetPWMode" element={<ResetPWMode />} />

<Route path="/record" element={<><RecordPage /><BottomNav /></>} />
<Route path="/statistics" element={<><StatisticsPage /><BottomNav /></>} />
<Route path="/settings" element={<><SettingsPage /><BottomNav /></>} />
<Route path="/settings/account" element={<AccountSetting />} />

<Route path="/record/edit" element={<EditRecordPage />} />
<Route path="/category" element={<CategoryPage />} />
<Route path="/category/edit" element={<EditCategoryPage />} />
</Routes>
</Box>
<PopupMessage />
<Modal />
</CookiesProvider>
</Box>
<PopupMessage />
<Modal />
</ThemeProvider>
</BrowserRouter>
);
Expand Down
29 changes: 0 additions & 29 deletions src/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,35 +55,6 @@ export const addUser = async (request: UserData) => {

/************************ SIGN IN ************************/

/**
* user sign in
* @param request: UserData
* @returns response
*/
export const signIn = async (request: UserData) => {
const response = await callAPI({
url: '/api/v1/auth/signin',
method: 'POST',
body: request,
});

return response as CommonResponse;
};

/**
* user social sign in
* @param registrationId (google / naver / kakao)
* @returns response
*/
export const socialSignIn = async (registrationId: string) => {
const response = await callAPI({
url: `/api/oauth2/authorization/${registrationId}`,
method: 'GET',
});

return response as CommonResponse;
};


/************************ USER INFO ************************/

Expand Down
16 changes: 4 additions & 12 deletions src/api/common/api.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import { Method } from 'axios';

import CommonResponse, { getInstance } from '../http';
import { Cookies } from 'react-cookie';

export interface APIContract {
headers?: any;
method: Method;
url: string;
params?: object;
body?: object;
}

const cookies = new Cookies();

export const callAPI = async <T = any>(
{ headers, url, method, params, body }: APIContract,
{ url, method, params, body }: APIContract,
isLoading?: boolean,
): Promise<any> => {
let response: CommonResponse = {
Expand All @@ -24,20 +20,16 @@ export const callAPI = async <T = any>(
};

try {
const request = {
headers: {
Authorization: `bearer ${cookies.get('accessToken')}`,
},
response = await getInstance(isLoading).request({
url,
method,
params,
data: body,
};
response = await getInstance(isLoading).request(request);
});
} catch (error) {
response.data = error;
}

// return response as CommonResponse<T>; 추후에 response 정해지면 any 대신 사용
return response as any;
};
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const GoogleIcon = () => {
const Naver = () => {
return (
<svg
width="46"
Expand Down Expand Up @@ -28,4 +28,4 @@ const GoogleIcon = () => {
);
};

export default GoogleIcon;
export default Naver;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const KakaoIcon = () => {
const Naver = () => {
return (
<svg
width="46"
Expand All @@ -16,4 +16,4 @@ const KakaoIcon = () => {
);
};

export default KakaoIcon;
export default Naver;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const NaverIcon = () => {
const Naver = () => {
return (
<svg
width="46"
Expand All @@ -16,4 +16,4 @@ const NaverIcon = () => {
);
};

export default NaverIcon;
export default Naver;
Loading

0 comments on commit cd63938

Please sign in to comment.