import React, { useState, useCallback } from 'react';

export default function () {
  const [lastBuildId, setLastBuildId] = useState<string>(''); //最后选择的建筑id
  const [lastFloorId, setLastFloorId] = useState<string>(''); //最后选择的楼层id

  const changeLastBuildId = useCallback((value: string) => {
    sessionStorage.setItem('lastBuildId', value);
    setLastBuildId(value);
  }, []);

  const changeLastFloorId = useCallback((value: string) => {
    sessionStorage.setItem('lastFloorId', value);
    setLastFloorId(value);
  }, []);

  return {
    lastBuildId,
    lastFloorId,
    changeLastBuildId,
    changeLastFloorId,
  };
}
