-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1034917
commit e932547
Showing
3 changed files
with
34 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {kyInstance} from './ky'; | ||
import {surveyApis} from './routes'; | ||
|
||
import {Survey} from '@/types'; | ||
import {createUrl} from '@/utils/url'; | ||
|
||
type ParamGetSurvey = { | ||
userId: string; | ||
}; | ||
|
||
type ResponseGetSurvey = { | ||
survey: Survey[]; | ||
}; | ||
|
||
async function getSurvey(param: ParamGetSurvey) { | ||
const apiUrl = createUrl(surveyApis.getSurvey, {param}); | ||
return await kyInstance.get(apiUrl).json<ResponseGetSurvey>(); | ||
} | ||
|
||
type BodyPostSurvey = { | ||
survey: Survey[]; | ||
}; | ||
|
||
async function postSurvey(body: BodyPostSurvey) { | ||
return await kyInstance.post(surveyApis.postSurvey, {json: body}).json(); | ||
} | ||
|
||
export {getSurvey, postSurvey}; | ||
export type {ParamGetSurvey, ResponseGetSurvey, BodyPostSurvey}; |
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,3 +1,4 @@ | ||
export * from './user'; | ||
export * from './auth'; | ||
export * from './question'; | ||
export * from './survey'; |
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,4 @@ | ||
export type Survey = { | ||
id: string; | ||
content: string; | ||
}; |