diff --git a/.gitignore b/.gitignore
index cd6585f..389dcef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,5 +20,5 @@
npm-debug.log*
yarn-debug.log*
-yarn-error.log*
-public
+yarn-error.log*
+public
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 9fe02a0..63f8cb0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
+ "name": "ticket-admin-22th",
"version": "0.1.0",
"dependencies": {
"@testing-library/jest-dom": "^5.16.4",
@@ -17126,19 +17127,6 @@
"is-typedarray": "^1.0.0"
}
},
- "node_modules/typescript": {
- "version": "4.7.4",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
- "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
- "peer": true,
- "bin": {
- "tsc": "bin/tsc",
- "tsserver": "bin/tsserver"
- },
- "engines": {
- "node": ">=4.2.0"
- }
- },
"node_modules/unbox-primitive": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
@@ -30352,12 +30340,6 @@
"is-typedarray": "^1.0.0"
}
},
- "typescript": {
- "version": "4.7.4",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
- "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
- "peer": true
- },
"unbox-primitive": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
diff --git a/src/apis/users/UsersApi.js b/src/apis/users/UsersApi.js
new file mode 100644
index 0000000..754e8e6
--- /dev/null
+++ b/src/apis/users/UsersApi.js
@@ -0,0 +1,3 @@
+const { default: axios } = require('axios');
+
+const { default: InstanceSetting } = require('../common/instance.api');
diff --git a/src/components/Tables/OrdersPage/OrdersPage.js b/src/components/Tables/OrdersPage/OrdersPage.js
index bccecbf..36f5011 100644
--- a/src/components/Tables/OrdersPage/OrdersPage.js
+++ b/src/components/Tables/OrdersPage/OrdersPage.js
@@ -1,7 +1,7 @@
-import React from "react";
+import React from 'react';
function OrdersPage() {
- return
OrdersPage
;
+ return 봉세환의 OrdersPage
;
}
export default OrdersPage;
diff --git a/src/components/Tables/TicketsPage/TicketsPage.js b/src/components/Tables/TicketsPage/TicketsPage.js
index d866fdd..0bae63f 100644
--- a/src/components/Tables/TicketsPage/TicketsPage.js
+++ b/src/components/Tables/TicketsPage/TicketsPage.js
@@ -1,7 +1,7 @@
-import React from "react";
+import React from 'react';
function TicketsPage() {
- return TicketsPage
;
+ return 티켓 페이지
;
}
export default TicketsPage;
diff --git a/src/components/Tables/UsersPage/Table.js b/src/components/Tables/UsersPage/Table.js
new file mode 100644
index 0000000..ba8daca
--- /dev/null
+++ b/src/components/Tables/UsersPage/Table.js
@@ -0,0 +1,76 @@
+import React, { useState, useEffect } from 'react';
+
+import { useSelector, useDispatch } from 'react-redux';
+import { Table } from 'antd';
+import { usersPage } from '../../../state/actions-creators/usersPage';
+import moment from 'moment';
+const { Column } = Table;
+
+function UsersPageTable() {
+ const dispatch = useDispatch();
+ const { data, pending } = useSelector(state => state.usersPage);
+ const [page, setPage] = useState(1);
+
+ const onPageChange = e => {
+ // 페이지네이션 번호 바뀔때 뜸.
+ console.log(e);
+ setPage(e);
+ dispatch(
+ usersPage({
+ requestPage: e
+ })
+ );
+ };
+
+ useEffect(() => {
+ dispatch(
+ usersPage({
+ requestPage: 1
+ })
+ );
+ }, [dispatch]);
+
+ // 받을 수 있는 정보 목록
+ // {
+ // "id": 3,
+ // "name": "강나연",
+ // "phoneNumber": "01075546670",
+ // "role": "Admin",
+ // "ticketNum": 0
+ // },
+
+ return (
+ <>
+
+
+
+
+
+ {
+ return moment(new Date(element)).format('MM월 DD일');
+ }}
+ />
+
+
+ >
+ );
+}
+
+export default UsersPageTable;
diff --git a/src/components/Tables/UsersPage/UserSearch.js b/src/components/Tables/UsersPage/UserSearch.js
new file mode 100644
index 0000000..58976d0
--- /dev/null
+++ b/src/components/Tables/UsersPage/UserSearch.js
@@ -0,0 +1,43 @@
+import { Button, Input, Select } from 'antd';
+import React, { useState } from 'react';
+const { Option } = Select;
+
+function UserSearch() {
+ const [searchOption, setSearchOption] = useState('입금자명');
+
+ const onOptionChange = e => {
+ console.log(e);
+ if (e === '1') {
+ setSearchOption('입금자명');
+ } else {
+ setSearchOption('전화번호');
+ }
+ };
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+ >
+ );
+}
+
+export default UserSearch;
diff --git a/src/components/Tables/UsersPage/UsersPage.js b/src/components/Tables/UsersPage/UsersPage.js
index adcd1ce..5564cc8 100644
--- a/src/components/Tables/UsersPage/UsersPage.js
+++ b/src/components/Tables/UsersPage/UsersPage.js
@@ -1,7 +1,14 @@
-import React from "react";
+import React from 'react';
+import UsersPageTable from './Table';
+import UserSearch from './UserSearch';
function UsersPage() {
- return UsersPage
;
+ return (
+
+
+
+
+ );
}
export default UsersPage;
diff --git a/src/hoc/AuthPass.js b/src/hoc/AuthPass.js
index 5b24637..2f57a2b 100644
--- a/src/hoc/AuthPass.js
+++ b/src/hoc/AuthPass.js
@@ -1,14 +1,14 @@
-import React from "react";
-import { Navigate } from "react-router-dom";
+import React from 'react';
+import { Navigate } from 'react-router-dom';
-import { useSelector } from "react-redux";
+import { useSelector } from 'react-redux';
const requireAuth =
- (Component) =>
+ Component =>
({ ...props }) => {
- const { authenticated } = useSelector((state) => state.auth);
+ const { authenticated } = useSelector(state => state.auth);
- console.log("인증 부분 검사", authenticated, !authenticated);
+ console.log('인증 부분 검사', authenticated, !authenticated);
return authenticated === false ? (
diff --git a/src/state/action-types/index.js b/src/state/action-types/index.js
index 30692f0..14f524d 100644
--- a/src/state/action-types/index.js
+++ b/src/state/action-types/index.js
@@ -2,3 +2,4 @@ export * from './slackMessage';
export * from './slackValidation';
export * from './logout';
export * from './examplePagination';
+export * from './usersPage';
diff --git a/src/state/action-types/usersPage.js b/src/state/action-types/usersPage.js
new file mode 100644
index 0000000..d5a8bb9
--- /dev/null
+++ b/src/state/action-types/usersPage.js
@@ -0,0 +1,3 @@
+export const USER_PAGE_PENDING = 'USER_PAGE_PENDING';
+export const USER_PAGE_SUCCESS = 'USER_PAGE_SUCCESS';
+export const USER_PAGE_ERROR = 'USER_PAGE_ERROR';
diff --git a/src/state/actions-creators/logout.js b/src/state/actions-creators/logout.js
index 88cccff..e9f6f15 100644
--- a/src/state/actions-creators/logout.js
+++ b/src/state/actions-creators/logout.js
@@ -6,7 +6,7 @@ import TicketsApi from '../../apis/tickets/TicketsApi';
export const logout = callback => async dispatch => {
dispatch({ type: LOGOUT_USER });
- localStorage.setItem('accessToken', null);
+ localStorage.removeItem('accessToken');
axios.defaults.headers.common.Authorization = null;
// 자동으로 피쳐로 넘어가게끔
diff --git a/src/state/actions-creators/usersPage.js b/src/state/actions-creators/usersPage.js
new file mode 100644
index 0000000..58b0a79
--- /dev/null
+++ b/src/state/actions-creators/usersPage.js
@@ -0,0 +1,34 @@
+import axios from 'axios';
+import {
+ USER_PAGE_PENDING,
+ USER_PAGE_SUCCESS,
+ USER_PAGE_ERROR
+} from '../action-types';
+
+export const usersPage =
+ ({ requestPage }, callback) =>
+ async dispatch => {
+ try {
+ dispatch({ type: USER_PAGE_PENDING });
+
+ const response = await axios.get(
+ `https://api.gosrock.band/v1/users/all?order=ASC&page=${requestPage}&take=10`
+ );
+
+ console.log('포토 조회액션1', response);
+
+ const data = {
+ total: response.data.data.meta.itemCount,
+ currentPage: requestPage,
+ userList: response.data.data.data
+ };
+
+ dispatch({ type: USER_PAGE_SUCCESS, payload: data });
+
+ // 자동으로 피쳐로 넘어가게끔
+ // callback();
+ } catch (e) {
+ //400 ~
+ dispatch({ type: USER_PAGE_ERROR, payload: '조회 실패' });
+ }
+ };
diff --git a/src/state/reducers/index.js b/src/state/reducers/index.js
index 7c28c67..d9017da 100644
--- a/src/state/reducers/index.js
+++ b/src/state/reducers/index.js
@@ -2,9 +2,11 @@ import { combineReducers } from 'redux';
import { auth } from './auth';
import examplePagination from './examplePagination';
import slackMessage from './slackMessage';
+import usersPage from './usersPage';
export default combineReducers({
slackMessage: slackMessage,
auth: auth,
- examplePagination: examplePagination
+ examplePagination: examplePagination,
+ usersPage: usersPage
});
diff --git a/src/state/reducers/usersPage.js b/src/state/reducers/usersPage.js
new file mode 100644
index 0000000..ef973c3
--- /dev/null
+++ b/src/state/reducers/usersPage.js
@@ -0,0 +1,39 @@
+import {
+ USER_PAGE_PENDING,
+ USER_PAGE_SUCCESS,
+ USER_PAGE_ERROR
+} from '../action-types';
+
+// eslint-disable-next-line import/no-anonymous-default-export
+export default function (
+ state = {
+ data: {
+ totalPage: 0,
+ currentPage: 1,
+ userList: []
+ },
+ error: null,
+ pending: false
+ },
+ action
+) {
+ switch (action.type) {
+ case USER_PAGE_PENDING:
+ return { ...state, data: action.payload, error: null, pending: true };
+ case USER_PAGE_SUCCESS:
+ return { ...state, data: action.payload, error: null, pending: false };
+ case USER_PAGE_ERROR:
+ return {
+ ...state,
+ data: {
+ totalPage: 0,
+ currentPage: 1,
+ userList: []
+ },
+ error: action.payload,
+ pending: false
+ };
+ default:
+ return state;
+ }
+}