refactor: canvas status 조회 함수에 userId 추가 방식 변경
This commit is contained in:
parent
64fa7c0642
commit
8f3f74b608
@ -6,6 +6,7 @@ import CanvasFrame from './CanvasFrame'
|
||||
import { usePlan } from '@/hooks/usePlan'
|
||||
import { globalLocaleStore } from '@/store/localeAtom'
|
||||
import { currentCanvasPlanState, initCanvasPlansState } from '@/store/canvasAtom'
|
||||
import { sessionStore } from '@/store/commonAtom'
|
||||
|
||||
export default function CanvasLayout() {
|
||||
const [objectNo, setObjectNo] = useState('test123240822001') // 이후 삭제 필요
|
||||
@ -14,6 +15,7 @@ export default function CanvasLayout() {
|
||||
const [currentCanvasPlan, setCurrentCanvasPlan] = useRecoilState(currentCanvasPlanState)
|
||||
const [initCanvasPlans, setInitCanvasPlans] = useRecoilState(initCanvasPlansState)
|
||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||
const sessionState = useRecoilValue(sessionStore)
|
||||
|
||||
const { getCanvasByObjectNo } = usePlan()
|
||||
|
||||
@ -63,7 +65,7 @@ export default function CanvasLayout() {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getCanvasByObjectNo(objectNo).then((res) => {
|
||||
getCanvasByObjectNo(sessionState.userId, objectNo).then((res) => {
|
||||
console.log('canvas 목록 ', res)
|
||||
if (res.length > 0) {
|
||||
setInitCanvasPlans(res)
|
||||
|
||||
@ -12,8 +12,6 @@ export function usePlan() {
|
||||
const [initCanvasPlans, setInitCanvasPlans] = useRecoilState(initCanvasPlansState)
|
||||
const { getMessage } = useMessage()
|
||||
const { get, promisePost, promisePut } = useAxios()
|
||||
const [sessionState, setSessionState] = useRecoilState(sessionStore)
|
||||
const [userId, setUserId] = useState(sessionState.userId)
|
||||
|
||||
/**
|
||||
* 마우스 포인터의 가이드라인을 제거합니다.
|
||||
@ -137,7 +135,7 @@ export function usePlan() {
|
||||
/**
|
||||
* objectNo에 해당하는 canvas 목록을 조회하는 함수
|
||||
*/
|
||||
const getCanvasByObjectNo = async (objectNo) => {
|
||||
const getCanvasByObjectNo = async (userId, objectNo) => {
|
||||
return get({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}/${userId}` }).then((res) =>
|
||||
res.map((item) => ({
|
||||
id: item.id,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user