CFE-26 rendering test and some change in callTabsList

This commit is contained in:
2023-10-15 14:17:10 +03:30
parent 4cabe9d171
commit ab29954941
10 changed files with 141 additions and 7 deletions

View File

@@ -17,7 +17,19 @@ export const AnswersContext = createContext()
export const AnswersProvider = ({children}) => {
const [openCallDialog, setOpenCallDialog] = useState(false)
const [activeTab, setActiveTab] = useState(0)
const [state, dispatch] = useReducer(reducer, []);
const [state, dispatch] = useReducer(reducer, [{
id:45,
phone_number:'09120630676',
active:true
}, {
id:50,
phone_number:'09120630675',
active:true
}, {
id:55,
phone_number:'09120630672',
active:true
}]);
return <AnswersContext.Provider
value={{

View File

@@ -0,0 +1,25 @@
import useRequest from "@/lib/app/hooks/useRequest";
import useSWR from "swr";
import {GET_TAB_DETAILS} from "@/core/data/apiRoutes";
const useAnswer = (id) => {
const requestServer = useRequest({auth: true, notification: false})
const fetcher = (...args) => {
return requestServer(args, 'get').then((response) => {
return response.data.data;
}).catch(() => {
})
};
const {data, error, isLoading} = useSWR(`${GET_TAB_DETAILS}/${id}`, fetcher, {
revalidateIfStale: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
keepPreviousData : true
})
//swr config
// render data
return {data, isLoading, error}
}
export default useAnswer;