diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..acb7f3f --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,37 @@ +name: Docker +on: + push: + branches: [main] + # Publish semver tags as releases. + tags: ["v*.*.*"] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: water0641/ticket-admin + tag-semver: | + {{version}} + {{major}}.{{minor}} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile.prod + platforms: linux/amd64 + push: true + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/.gitignore b/.gitignore index 4d29575..cd6585f 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +public diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..57757f4 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm run lint-staged diff --git a/package-lock.json b/package-lock.json index 7c6dc5b..9d00924 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,9 @@ "redux": "^4.2.0", "redux-thunk": "^2.4.1", "web-vitals": "^2.1.4" + }, + "devDependencies": { + "husky": "^8.0.1" } }, "node_modules/@ampproject/remapping": { @@ -8859,6 +8862,21 @@ "node": ">=10.17.0" } }, + "node_modules/husky": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz", + "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -23987,6 +24005,12 @@ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" }, + "husky": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz", + "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==", + "dev": true + }, "iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", diff --git a/package.json b/package.json index d2c3230..e602fac 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,18 @@ "redux-thunk": "^2.4.1", "web-vitals": "^2.1.4" }, + "lint-staged": { + "**/*.{js,jsx,json,tsx}": [ + "prettier --write" + ] + }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "prepare": "husky install", + "lint-staged": "lint-staged" }, "eslintConfig": { "extends": [ @@ -41,5 +48,8 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "devDependencies": { + "husky": "^8.0.1" } } diff --git a/src/components/AuthPage/LoginPage.js b/src/components/AuthPage/LoginPage.js index e611208..7e2b870 100644 --- a/src/components/AuthPage/LoginPage.js +++ b/src/components/AuthPage/LoginPage.js @@ -8,10 +8,10 @@ import { slackValidation, slackMessage } from "../../state/actions-creators"; function LoginPage() { const dispatch = useDispatch(); - const { error } = useSelector((state) => state.slackMessage); - // const { adminValidationToken } = useSelector( - // (state) => state.slackValidation - // ); + const { tickets, error, pending } = useSelector( + (state) => state.slackMessage + ); + const [phoneNumber, setPhoneNumber] = useState(""); const [slackEmail, setSlackEmail] = useState(""); const [validationNumber, setValidationNumber] = useState(""); diff --git a/src/state/actions-creators/slackMessage.js b/src/state/actions-creators/slackMessage.js index 4e895a8..163e483 100644 --- a/src/state/actions-creators/slackMessage.js +++ b/src/state/actions-creators/slackMessage.js @@ -23,6 +23,13 @@ export const slackMessage = phoneNumber, slackEmail, }); + // const response = await axios.post( + // "https://api.gosrock.band/v1/auth/slack/send", + // { + // phoneNumber, + // slackEmail, + // } + // ); console.log(response); diff --git a/src/state/storeSetting.js b/src/state/storeSetting.js index 9ed5efd..b261222 100644 --- a/src/state/storeSetting.js +++ b/src/state/storeSetting.js @@ -20,7 +20,7 @@ const adminAccessToken = localStorage.getItem("accessToken"); console.log(adminAccessToken); // axios Bearer 토큰에 커먼 헤더로 껴놓기 위함 let authenticated = false; -if (adminAccessToken !== null && !adminAccessToken.length) { +if (adminAccessToken && adminAccessToken.length) { authenticated = true; axios.defaults.headers.common.Authorization = `Bearer ${adminAccessToken}`; }