-
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.
[feat/#28] 거북목, 어깨 틀어짐 자세 유지 시 서버에 데이터 전송
- Loading branch information
Showing
7 changed files
with
107 additions
and
50 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
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,26 @@ | ||
import { pose } from "@/utils" | ||
import axiosInstance from "./axiosInstance" | ||
|
||
export type poseType = "GOOD" | "TURTLE_NECK" | "SHOULDER_TWIST" | "CHIN_UTP" | "TAILBONE_SIT" | ||
|
||
export interface poseReq { | ||
snapshot: pose | ||
type: poseType | ||
imageUrl?: string | ||
} | ||
|
||
export interface poseRes { | ||
id: number | ||
uid: number | ||
type: poseType | ||
createdAt: string | ||
} | ||
export const sendPose = async (poseReq: poseReq): Promise<poseRes> => { | ||
try { | ||
const res = await axiosInstance.post(`/pose-snapshots`, { ...poseReq }) | ||
const { id, uid, type, createdAt } = res.data.data | ||
return { id, uid, type, createdAt } | ||
} catch (e) { | ||
throw e | ||
} | ||
} |
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
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,13 @@ | ||
import { poseReq, poseRes, sendPose } from "@/api/pose" | ||
import { useMutation, UseMutationResult } from "@tanstack/react-query" | ||
|
||
export const useSendPose = (): UseMutationResult<poseRes, unknown, poseReq, unknown> => { | ||
return useMutation({ | ||
mutationFn: (poseReq: poseReq) => { | ||
return sendPose(poseReq) | ||
}, | ||
onSuccess: (data) => { | ||
console.log(data) | ||
}, | ||
}) | ||
} |
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