diff --git a/src/App.tsx b/src/App.tsx index bb92570..5e12651 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,6 +8,7 @@ import './App.less'; import Home from './containers/home/Home'; import Signup from './containers/signup/Signup'; import Login from './containers/login/Login'; +import Settings from './containers/settings/Settings'; import BlockTemplate from './containers/template-1-col-block/Template'; import GridTemplate from './containers/template-24-col-grid/Template'; @@ -38,6 +39,7 @@ const App: React.FC = () => { + diff --git a/src/auth/authAPI.tsx b/src/auth/authAPI.tsx index 086ddf6..49089b9 100644 --- a/src/auth/authAPI.tsx +++ b/src/auth/authAPI.tsx @@ -5,6 +5,7 @@ enum ROUTES { LOGIN = '/api/v1/user/login/', SIGNUP = '/api/v1/user/signup/', REFRESH = '/api/v1/user/login/refresh/', + DELETE_ACCOUNT = '/api/v1/user', } interface LoginRequest { @@ -51,6 +52,22 @@ export const logout: () => Promise = async () => Token.removeRefreshToken(); }); +export const deleteAccount: () => Promise = async () => + Axios.delete(ROUTES.DELETE_ACCOUNT, { + headers: { + 'X-Access-Token': Token.getAccessToken(), + 'X-Refresh-Token': Token.getRefreshToken(), + }, + }) + .then((response) => { + Token.removeAccessToken(); + Token.removeRefreshToken(); + }) + .catch(() => { + Token.removeAccessToken(); + Token.removeRefreshToken(); + }); + export const refresh: () => Promise = async () => Axios.post(ROUTES.REFRESH, null, { headers: { diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx index 8134fef..f0b9cb9 100644 --- a/src/components/NavBar.tsx +++ b/src/components/NavBar.tsx @@ -20,6 +20,8 @@ const NavBar: React.FC = () => { return '4'; case '/signup': return '5'; + case '/settings': + return '6'; default: return '1'; } @@ -72,6 +74,14 @@ const NavBar: React.FC = () => { > Sign Up + { + history.push('/settings'); + }} + > + Settings + ); diff --git a/src/containers/home/Home.tsx b/src/containers/home/Home.tsx index 32dd3c4..38dc41d 100644 --- a/src/containers/home/Home.tsx +++ b/src/containers/home/Home.tsx @@ -1,6 +1,5 @@ import React from 'react'; import { Helmet } from 'react-helmet'; -import './home.less'; import { Button, Form, Input, Typography } from 'antd'; import { login } from '../../auth/authAPI'; const { Title } = Typography; diff --git a/src/containers/home/home.less b/src/containers/home/home.less deleted file mode 100644 index e69de29..0000000 diff --git a/src/containers/login/Login.tsx b/src/containers/login/Login.tsx index c25701e..89e7bb5 100644 --- a/src/containers/login/Login.tsx +++ b/src/containers/login/Login.tsx @@ -1,6 +1,5 @@ import React from 'react'; import { Helmet } from 'react-helmet'; -import './login.less'; import { Button, Form, Input, Typography } from 'antd'; import { login } from '../../auth/authAPI'; import { Link } from 'react-router-dom'; diff --git a/src/containers/login/login.less b/src/containers/login/login.less deleted file mode 100644 index e69de29..0000000 diff --git a/src/containers/not-found/NotFound.tsx b/src/containers/not-found/NotFound.tsx index 47b169f..b4660b0 100644 --- a/src/containers/not-found/NotFound.tsx +++ b/src/containers/not-found/NotFound.tsx @@ -2,7 +2,6 @@ import React from 'react'; import { Helmet } from 'react-helmet'; import { Link } from 'react-router-dom'; import { Typography } from 'antd'; -import './not-found.less'; const { Title } = Typography; /* diff --git a/src/containers/not-found/not-found.less b/src/containers/not-found/not-found.less deleted file mode 100644 index e69de29..0000000 diff --git a/src/containers/settings/Settings.tsx b/src/containers/settings/Settings.tsx new file mode 100644 index 0000000..ca121cc --- /dev/null +++ b/src/containers/settings/Settings.tsx @@ -0,0 +1,32 @@ +import React from 'react'; +import { Helmet } from 'react-helmet'; +import { Button, Form, Typography } from 'antd'; +import { deleteAccount } from '../../auth/authAPI'; +const { Title } = Typography; + +const Settings: React.FC = () => { + const onFinish = () => { + deleteAccount(); + }; + + return ( + <> + + Settings + + +
+ Settings +
+ + + +
+
+ + ); +}; + +export default Settings; diff --git a/src/containers/signup/Signup.tsx b/src/containers/signup/Signup.tsx index 4f05e00..ebe9968 100644 --- a/src/containers/signup/Signup.tsx +++ b/src/containers/signup/Signup.tsx @@ -1,6 +1,5 @@ import React from 'react'; import { Helmet } from 'react-helmet'; -import './signup.less'; import { Button, Form, Input, Typography } from 'antd'; import { signup } from '../../auth/authAPI'; import { Link } from 'react-router-dom'; diff --git a/src/containers/signup/signup.less b/src/containers/signup/signup.less deleted file mode 100644 index e69de29..0000000 diff --git a/src/containers/template-1-col-block/Template.tsx b/src/containers/template-1-col-block/Template.tsx index 8779427..080ccf1 100644 --- a/src/containers/template-1-col-block/Template.tsx +++ b/src/containers/template-1-col-block/Template.tsx @@ -1,6 +1,5 @@ import React from 'react'; import { Helmet } from 'react-helmet'; -import './template.less'; import { Typography } from 'antd'; import { Link } from 'react-router-dom'; diff --git a/src/containers/template-1-col-block/template.less b/src/containers/template-1-col-block/template.less deleted file mode 100644 index e69de29..0000000