-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/notification' into develop
- Loading branch information
Showing
4 changed files
with
155 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
/* 일대일 문의 전체 조회 */ | ||
|
||
import { getRequest } from '../request'; | ||
import { QuestionType } from '../types/question'; | ||
import { getRequest, postRequest } from '../request'; | ||
import { | ||
PostQuestionTypeResponse, | ||
QuestionPost, | ||
GetQuestionType | ||
} from '../types/question'; | ||
|
||
export const userinfo = async () => { | ||
const response = await getRequest<QuestionType>('privatePosts'); | ||
export const questioninfo = async () => { | ||
const response = await getRequest<GetQuestionType>( | ||
`privatePosts?page=1&size=100&sort=string` | ||
); | ||
return response; | ||
}; | ||
|
||
/* 일대일 문의 등록 */ | ||
|
||
export const registerquestion = async ({ title, content, branchName }: QuestionPost) => { | ||
const response = await postRequest<PostQuestionTypeResponse, QuestionPost>( | ||
'privatePosts', | ||
{ title, content, branchName } | ||
); | ||
return response; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
// import { Branch } from './branch'; | ||
import { ICommon } from './common'; | ||
export interface QuestionPost { | ||
title: string; | ||
content: string; | ||
branchName: string | undefined; | ||
} | ||
|
||
interface QuestionPost { | ||
interface QuestionGet { | ||
id: number; | ||
title: string; | ||
content: string; | ||
branchName: string; | ||
createdDate: string; | ||
} | ||
|
||
interface QuestionPosttResponse { | ||
privatePostList: QuestionPost[]; | ||
interface QuestionGetResponse { | ||
privatePostList: QuestionGet[]; | ||
hasNext: boolean; | ||
} | ||
|
||
interface Message { | ||
message: string; | ||
interface QuestionMessage { | ||
id: number; | ||
} | ||
|
||
export type QuestionType = ICommon<QuestionPosttResponse & Message>; | ||
export type GetQuestionType = ICommon<QuestionGetResponse>; | ||
|
||
export type PostQuestionTypeResponse = ICommon<QuestionMessage>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// branch.store.ts | ||
/* eslint-disable no-unused-vars */ | ||
import { create } from 'zustand'; | ||
import { Branch } from '@/api/types/branch'; | ||
import { persist } from 'zustand/middleware'; | ||
|
||
interface QuestionBranch { | ||
selectedQuestionBranch: Branch | null; | ||
setSelectedQuestionBranch: (branch: Branch | null, time: number) => void; | ||
updatedTimeSelected: number | null; | ||
} | ||
|
||
export const useQuestionBranchStore = create( | ||
persist<QuestionBranch>( | ||
(set) => ({ | ||
selectedQuestionBranch: null, | ||
setSelectedQuestionBranch: (branch: Branch | null, time: number) => | ||
set({ selectedQuestionBranch: branch, updatedTimeSelected: time }), | ||
updatedTimeSelected: null | ||
}), | ||
{ | ||
name: 'selectedBranch' | ||
} | ||
) | ||
); |