From 2c26fe2cc101a1a055e7ef224ac8c03882e41d75 Mon Sep 17 00:00:00 2001 From: Clzzi Date: Mon, 9 May 2022 20:54:53 +0900 Subject: [PATCH 01/11] chore(assets): add lion svg --- public/assets/Lion.svg | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 public/assets/Lion.svg diff --git a/public/assets/Lion.svg b/public/assets/Lion.svg new file mode 100644 index 0000000..bf482e0 --- /dev/null +++ b/public/assets/Lion.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + From 2071a41a1f2de45aa96a7385b71c20a16bc22b30 Mon Sep 17 00:00:00 2001 From: Clzzi Date: Mon, 9 May 2022 20:55:11 +0900 Subject: [PATCH 02/11] feat(api): adding resume api --- src/core/apis/resume/resume.api.ts | 24 +++++++++++++++++++++++- src/core/apis/resume/resume.param.ts | 12 ++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/core/apis/resume/resume.api.ts b/src/core/apis/resume/resume.api.ts index 1fa8656..5599f1b 100644 --- a/src/core/apis/resume/resume.api.ts +++ b/src/core/apis/resume/resume.api.ts @@ -1,5 +1,12 @@ import customAxios from 'src/core/libs/axios/customAxios'; -import { aResumeParam, AResumeResponse, ResumesResponse } from './resume.param'; +import { Response } from 'src/types/common.type'; +import { + aResumeParam, + AResumeResponse, + makeResumeParams, + ResumesResponse, + UploadResponse, +} from './resume.param'; class Resume { public async getResumes(): Promise { @@ -13,6 +20,21 @@ class Resume { ); return data; } + + public async upload(file: FormData): Promise { + const { data } = await customAxios.post('/image', file); + return data; + } + + public async makeResume(parmas: makeResumeParams): Promise { + const { data } = await customAxios.post('/resume', parmas); + return data; + } + + public async deleteResume(): Promise { + const { data } = await customAxios.delete('/resume'); + return data; + } } export default new Resume(); diff --git a/src/core/apis/resume/resume.param.ts b/src/core/apis/resume/resume.param.ts index 5bc5bab..4e45cf2 100644 --- a/src/core/apis/resume/resume.param.ts +++ b/src/core/apis/resume/resume.param.ts @@ -12,3 +12,15 @@ export interface ResumesResponse extends Response { export interface aResumeParam { idx: number; } + +export interface UploadResponse extends Response { + data: string[]; +} + +export interface makeResumeParams { + title: string | undefined; + company: string | undefined; + stack: string | undefined; + thumbnail: string | undefined; + content: string | undefined; +} From 6a1e15b67f0d1949a681b04aa87271cf90b4e643 Mon Sep 17 00:00:00 2001 From: Clzzi Date: Mon, 9 May 2022 20:56:06 +0900 Subject: [PATCH 03/11] feat(resumeWrite): connect api resumeWrite page --- src/components/ResumeInfo/index.tsx | 134 +++++++++++++-------- src/components/common/ImageInput/index.tsx | 12 +- src/components/common/Layout/Header.tsx | 11 +- src/components/common/PDFInput/index.tsx | 13 +- src/core/hooks/useForm.ts | 2 - src/core/utils/resume.ts | 11 ++ src/pages/index.tsx | 5 +- src/pages/resume/[idx].tsx | 17 ++- src/pages/resume/write.tsx | 99 +++++++++------ 9 files changed, 203 insertions(+), 101 deletions(-) create mode 100644 src/core/utils/resume.ts diff --git a/src/components/ResumeInfo/index.tsx b/src/components/ResumeInfo/index.tsx index c5a168e..971b591 100644 --- a/src/components/ResumeInfo/index.tsx +++ b/src/components/ResumeInfo/index.tsx @@ -1,4 +1,6 @@ import { NextRouter, useRouter } from 'next/router'; +import { useCallback, useEffect } from 'react'; +import resumeApi from 'src/core/apis/resume/resume.api'; import { Tag } from 'src/core/styles/shareStyle'; import { theme } from 'src/core/styles/theme'; import styled from 'styled-components'; @@ -10,6 +12,7 @@ interface Props { stack: string; company: string; title: string; + isMyResume: boolean; } export const ResumeInfo = ({ @@ -18,44 +21,57 @@ export const ResumeInfo = ({ name, stack, title, + isMyResume, }: Props) => { const router: NextRouter = useRouter(); + + const handleDeleteResume = useCallback(async () => { + try { + await resumeApi.deleteResume(); + router.push('/'); + } catch (e: any) { + console.error(e); + } + }, [router]); + return ( - -
- {`${generation}기 ${name}`} - - -