Skip to content

Instantly share code, notes, and snippets.

View nabanita-sarkar's full-sized avatar
🎯
Focusing

Nabanita Sarkar nabanita-sarkar

🎯
Focusing
View GitHub Profile
import numpy as np
import matplotlib.pyplot as plt
#Carrier wave c(t)=A_c*cos(2*pi*f_c*t)
#Modulating wave m(t)=A_m*cos(2*pi*f_m*t)
#Modulated wave s(t)=A_c[1+mu*cos(2*pi*f_m*t)]cos(2*pi*f_c*t)
A_c = float(input('Enter carrier amplitude: '))
f_c = float(input('Enter carrier frquency: '))
A_m = float(input('Enter message amplitude: '))
import { message } from "antd"
const { isLoading, isError, mutateAsync } = useMutation(
"todo/create",
() => {
return axios.post("http://localhost:4000/todo/create", task)
},
{
onSuccess: res => {
dispatch(setTaskList(res.data.task_list))
// in todo/all query we are fetching the list of all todos
const { isLoading, isError, data } = useQuery("todo/all", () => {
return axios.get(`http://localhost:4000/todo/all`)
})
const { isLoading, isError, data } = useQuery(
"todo/all",
() => {
return axios.get(`http://localhost:4000/todo/all`);
},
{
retry: 1, // or `true` or `false` or e.g. 6
}
);
const { id } = useParams(); // from react-router
const { isLoading, isError, data } = useQuery(
["todo/detail", id],
() => {
return axios.get(`http://localhost:4000/todo/detail/:${id}`);
},
{
enabled: !!id,
}
// in the component use it just like this
const { isLoading, isError, data } = useGetTodoById(id)
const { isLoading, isError, data } = useQuery(
["todo/detail", id],
() => {
return axios.get(`http://localhost:4000/todo/detail/:${id}`);
},
{
enabled: !!id,
retry: 1,
onSuccess: () => {
// invalidate some query
const {
isLoading: isAllTodoLoading,
isError: isAllTodoError,
data: allTodo,
} = useQuery("todo/all", () => {
return axios.post("http://localhost:4000/todo/all", todo)
})