From a4f2dd6077d95fa74d4ea165c0715e36901ed7e6 Mon Sep 17 00:00:00 2001 From: pinomaker-hoo Date: Wed, 14 Feb 2024 17:48:25 +0900 Subject: [PATCH] fix --- .env.development | 8 +- Dockerfile | 1 - package.json | 1 + src/components/ImageUploader/index.tsx | 43 +++++---- src/pages/login-page/index.tsx | 1 + src/pages/login-page/login-page.tsx | 6 ++ yarn.lock | 127 ++++++++++++++++++++++++- 7 files changed, 157 insertions(+), 30 deletions(-) diff --git a/.env.development b/.env.development index 6831d93..58eafc2 100644 --- a/.env.development +++ b/.env.development @@ -11,7 +11,7 @@ VITE_APP_ID=1:199773642283:web:644baf30eae6d68fd1d46e VITE_MEASUREMENT_ID=G-H1ZSMFWDEG # MINIO Key -VITE_MINIO_ACCESS_KEY=rGoq9X6LhOM4Dgky7X9F -VITE_MINIO_SECRET_KEY=HqWnw2VKryLzuCA3epMT1JTY3HTEsWHUwq4gfQmy -VITE_MINIO_ENDPOINT=http://125.133.34.224:9000 -VITE_MINIO_BUCKET_NAME=dice-dev \ No newline at end of file +VITE_MINIO_ACCESS_KEY=aEfGKpyfsI6DeYQXJfPd +VITE_MINIO_SECRET_KEY=vL3CaL9aT4uj29FrbuIuiiGnRQs9UNR1dW79pIok +VITE_MINIO_ENDPOINT=http://cloud.aiaracorp.com:9000 +VITE_MINIO_BUCKET_NAME=apk diff --git a/Dockerfile b/Dockerfile index ec363e3..f58b445 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ FROM node:18-alpine AS base - FROM base AS deps RUN apk add --no-cache libc6-compat diff --git a/package.json b/package.json index faaf4d1..752b3af 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@mui/x-tree-view": "^6.17.0", "@reduxjs/toolkit": "^1.9.5", "async-mutex": "^0.4.0", + "aws-sdk": "^2.1524.0", "axios": "^1.6.1", "firebase": "^10.3.1", "lodash": "^4.17.21", diff --git a/src/components/ImageUploader/index.tsx b/src/components/ImageUploader/index.tsx index ed9398e..9ee8717 100644 --- a/src/components/ImageUploader/index.tsx +++ b/src/components/ImageUploader/index.tsx @@ -5,7 +5,7 @@ import { ChangeEvent, useEffect, useRef } from 'react' import { Box } from '@mui/material' // ** Aws Imports -// import AWS from 'aws-sdk' +import AWS from 'aws-sdk' interface PropsType { image: string @@ -37,25 +37,26 @@ export const ImageUploader = ({ const file = event.target.files?.[0] if (file) { - // const s3 = new AWS.S3({ - // accessKeyId: import.meta.env.VITE_MINIO_ACCESS_KEY, - // secretAccessKey: import.meta.env.VITE_MINIO_SECRET_KEY, - // endpoint: import.meta.env.VITE_MINIO_ENDPOINT, - // s3ForcePathStyle: true, - // signatureVersion: 'v4', - // }) - // const params = { - // Bucket: import.meta.env.VITE_MINIO_BUCKET_NAME, - // Key: file.name, - // Body: file, - // } - // s3.upload(params, (err, data) => { - // if (err) { - // console.error(err) - // return - // } - // setPath(data.Location) - // }) + const s3 = new AWS.S3({ + accessKeyId: import.meta.env.VITE_MINIO_ACCESS_KEY, + secretAccessKey: import.meta.env.VITE_MINIO_SECRET_KEY, + endpoint: import.meta.env.VITE_MINIO_ENDPOINT, + s3ForcePathStyle: true, + signatureVersion: 'v4', + }) + const params = { + Bucket: import.meta.env.VITE_MINIO_BUCKET_NAME, + Key: file.name, + Body: file, + } + s3.upload(params, (err, data) => { + if (err) { + console.error(err) + return + } + console.log(data) + setPath(data.Location) + }) } } @@ -95,7 +96,7 @@ export const ImageUploader = ({ )} { } }) .catch((err) => { + console.log(err) onError('알림', err.data.message) }) } diff --git a/src/pages/login-page/login-page.tsx b/src/pages/login-page/login-page.tsx index d0c7835..e83c5f5 100644 --- a/src/pages/login-page/login-page.tsx +++ b/src/pages/login-page/login-page.tsx @@ -18,6 +18,7 @@ import { // ** Type Imporst import type { SocialType, UserLoginParams } from '@/types/user' +import { ImageUploader } from '@/components/ImageUploader' interface PropsType { user: UserLoginParams @@ -34,6 +35,10 @@ const LoginPageView = ({ handleSocial, handleEnter, }: PropsType) => { + const handleSetPath = (path: string) => { + console.log(path) + // setWorkspace((cur) => ({ ...cur, profile: path })) + } return ( + =5.1.0: resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +sax@1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz#7b8e656190b228e81a66aea748480d828cd2d37a" + integrity sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA== + +sax@>=0.6.0: + version "1.3.0" + resolved "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz#a5dbe77db3be05c9d1ee7785dbd3ea9de51593d0" + integrity sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA== + saxes@^6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5" @@ -5856,6 +5938,14 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" +url@0.10.3: + version "0.10.3" + resolved "https://registry.npmjs.org/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64" + integrity sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ== + dependencies: + punycode "1.3.2" + querystring "0.2.0" + use-sync-external-store@1.2.0, use-sync-external-store@^1.0.0: version "1.2.0" resolved "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" @@ -5866,6 +5956,22 @@ util-deprecate@^1.0.2: resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== +util@^0.12.4: + version "0.12.5" + resolved "https://registry.npmjs.org/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" + integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== + dependencies: + inherits "^2.0.3" + is-arguments "^1.0.4" + is-generator-function "^1.0.7" + is-typed-array "^1.1.3" + which-typed-array "^1.1.2" + +uuid@8.0.0: + version "8.0.0" + resolved "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz#bc6ccf91b5ff0ac07bbcdbf1c7c4e150db4dbb6c" + integrity sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw== + v8-compile-cache-lib@^3.0.1: version "3.0.1" resolved "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" @@ -5965,7 +6071,7 @@ which-collection@^1.0.1: is-weakmap "^2.0.1" is-weakset "^2.0.1" -which-typed-array@^1.1.11, which-typed-array@^1.1.13: +which-typed-array@^1.1.11, which-typed-array@^1.1.13, which-typed-array@^1.1.2: version "1.1.13" resolved "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz#870cd5be06ddb616f504e7b039c4c24898184d36" integrity sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow== @@ -6015,6 +6121,19 @@ xml-name-validator@^4.0.0: resolved "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== +xml2js@0.5.0: + version "0.5.0" + resolved "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz#d9440631fbb2ed800203fad106f2724f62c493b7" + integrity sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA== + dependencies: + sax ">=0.6.0" + xmlbuilder "~11.0.0" + +xmlbuilder@~11.0.0: + version "11.0.1" + resolved "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3" + integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA== + xmlchars@^2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"