Skip to content

Commit

Permalink
Feat: 자주묻는질문 관리 페이지를 추가하다
Browse files Browse the repository at this point in the history
  • Loading branch information
sanoopark committed Aug 12, 2023
1 parent 9087454 commit 790ec5a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/pages/FaqPage/FaqPage.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ import { Editor, EditorAside } from '@/components';
import * as Styled from './FaqPage.styled';
import { $teams, $profile } from '@/store';
import { SelectSize } from '@/components/common/Select/Select.component';
import { decodeHTMLEntities, getDefaultEditorData, removeWrongAmpString, request } from '@/utils';
import {
decodeHTMLEntities,
getDefaultEditorData,
getLocalStorageData,
removeWrongAmpString,
request,
} from '@/utils';
import { useToast } from '@/hooks';
import { ToastType } from '@/components/common/Toast/Toast.component';
import * as api from '@/api';
import { Team } from '@/components/common/UserProfile/UserProfile.component';

const EDITOR_ID = 'platform-faq-editor';
const commonSelectOption = { label: '공통', value: 'common' };
Expand All @@ -27,7 +34,7 @@ const FaqPage = () => {
}));

const myTeamName = useRecoilValue($profile)[0];
const isStaffUser = myTeamName === 'MASHUP';
const isStaffUser = myTeamName === Team.mashUp;

const getTeamSelectOptions = () => {
if (isStaffUser) return [{ label: commonSelectOption.label, value: commonSelectOption.value }];
Expand All @@ -38,7 +45,7 @@ const FaqPage = () => {
const teamSelectOptions = getTeamSelectOptions();

const handleUpdateButtonClick = async () => {
const originalOutputData = JSON.parse(localStorage.getItem(EDITOR_ID) ?? '{}');
const originalOutputData = getLocalStorageData(EDITOR_ID);
const storageValue = { editorData: originalOutputData };

request({
Expand Down
1 change: 1 addition & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export * from './number';
export * from './format';
export * from './schedule';
export * from './editor';
export * from './storage';
3 changes: 3 additions & 0 deletions src/utils/storage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const getLocalStorageData = (key: string) => {
return JSON.parse(localStorage.getItem(key) ?? '{}');
};

0 comments on commit 790ec5a

Please sign in to comment.