CFE-26 rendering test and some change in callTabsList
This commit is contained in:
@@ -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={{
|
||||
|
||||
25
src/lib/callWidget/hooks/useAnswer.jsx
Normal file
25
src/lib/callWidget/hooks/useAnswer.jsx
Normal 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;
|
||||
Reference in New Issue
Block a user