Skip to content

Commit

Permalink
fix: 공용 쿼리 훅 수정 (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
21ow committed Jan 17, 2025
1 parent 16eda8d commit 49cfa50
Show file tree
Hide file tree
Showing 19 changed files with 962 additions and 494 deletions.
10 changes: 9 additions & 1 deletion next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ const nextConfig: NextConfig = {
includePaths: [path.join(__dirname, 'src')],
additionalData: `@use '@/asset/variables' as *;`,
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'sprint-fe-project.s3.ap-northeast-2.amazonaws.com',
},
],
},
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
Expand All @@ -16,4 +24,4 @@ const nextConfig: NextConfig = {
},
};

export default nextConfig;
module.exports = nextConfig;
33 changes: 33 additions & 0 deletions src/api/ImageApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import axiosInstance from '@/lib/axiosInstance';
import sessionStorage from './storage/sessionStorage';
import { ImageRequest, ImageResponse } from './type/Image';

/*** 이미지 업로드
* 프로젝트에 저장하는 이미지들은 이 엔드포인트를 통해 업로드한 후 URL을 획득하여 사용합니다.
*/
export const postImagesUpload = async (
data: ImageRequest
): Promise<ImageResponse> => {
// create formdata
const formData = new FormData();
formData.append('image', data.file);

const URL = `/images/upload`;
console.log('POST - postImagesUpload(): ', URL);

try {
const res = await axiosInstance.post(URL, formData);

if (res.status === 200 || res.status === 201) {
const resData = res.data as ImageResponse;
sessionStorage.setItem(`postImagesUpload`, resData);
return resData;
} else {
throw new Error(
`Failed to postImagesUpload() res.status: ${res.status}, res.data: ${res.data}`
);
}
} catch (error) {
throw error;
}
};
279 changes: 0 additions & 279 deletions src/api/apiEndpoints.ts

This file was deleted.

Loading

0 comments on commit 49cfa50

Please sign in to comment.