Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: License -> SampleImages #338

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/axios/order/editor/License.js

This file was deleted.

6 changes: 6 additions & 0 deletions src/axios/order/editor/SampleImages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { SAMPLE_LIST } from '../../../constants/api';
import request from '../../axios';

export const getSampleList = async () => {
return request.get(SAMPLE_LIST());
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ import { Block } from 'baseui/block';
import useSidebarOpen from '../../../../../hooks/useSidebarOpen';
import AngleDoubleLeft from '../../icons/AngleDoubleLeft';
import { useCallback, useEffect, useState } from 'react';
import { getLicenseList } from '../../../../../axios/order/editor/License';
import { getSampleList } from '../../../../../axios/order/editor/SampleImages';
import { useEditor } from '@layerhub-io/react';
import Scrollable from '../../common/Scrollable';
import { useStyletron } from 'baseui';

const License = () => {
const SampleImages = () => {
const { setIsSidebarOpen } = useSidebarOpen();
const [licenses, setLicenses] = useState([]);
const [sampleImages, setSampleImages] = useState([]);
const editor = useEditor();

useEffect(() => {
getLicense();
getSampleImages();
}, []);

const getLicense = () => {
getLicenseList().then((res) => {
setLicenses(res.data);
const getSampleImages = () => {
getSampleList().then((res) => {
setSampleImages(res.data);
});
};

Expand Down Expand Up @@ -64,12 +64,12 @@ const License = () => {
gridTemplateColumns: '1fr 1fr',
}}
>
{licenses.map((license, index) => {
{sampleImages.map((sampleImage, index) => {
return (
<ImageItem
key={index}
onClick={() => addObject(license.imageUrl)}
preview={license.imageUrl}
onClick={() => addObject(sampleImage.imageUrl)}
preview={sampleImage.imageUrl}
/>
);
})}
Expand Down Expand Up @@ -144,4 +144,4 @@ const ImageItem = ({ preview, onClick }) => {
);
};

export default License;
export default SampleImages;
2 changes: 1 addition & 1 deletion src/component/order/editor/panels/panelItems/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/no-anonymous-default-export */
import Customize from './Customize';
import Uploads from './Uploads';
import Images from './Images';
import Images from './SampleImages';
import Layers from './Layers';
import AI from './AI';
import Text from './Text';
Expand Down
3 changes: 1 addition & 2 deletions src/constants/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const PATCH_NOTICE_COMMENT = (noticeId, commentId) =>
export const DELETE_NOTICE_COMMENT = (noticeId, commentId) =>
`/auth/notices/${noticeId}/comments/${commentId}`;


// order api
export const PRODUCT_INFO = (id) => `/product/products/${id}`;
export const LICENSE_IMAGES = (productId) => `/product/licenseProductOptionInfo/${productId}`;
Expand All @@ -26,7 +25,7 @@ export const LICENSE_IMAGES = (productId) => `/product/licenseProductOptionInfo/
export const CREATE_REVIEW = () => `/product/reviews`;
export const DELETE_REVIEW = (reviewId) => `/product/reviews/${reviewId}`;

export const LICENSE_LIST = () => `/product/licenseImage`;
export const SAMPLE_LIST = () => `/product/licenseImage`;

// cart api
export const ADD_CART_CUSTOM = () => '/product/carts/custom-products';
Expand Down
Loading