Fix rest verbs
This commit is contained in:
1 parent
b5e12dabc4
commit
aed4881eac
4 files changed
+14
-20
No files matched your search
@@ -61,7 +61,7 @@ export const update = createAsyncThunk(
|
|||||||
form.deleteProfileImage &&
|
form.deleteProfileImage &&
|
||||||
fd.append("deleteProfileImage", form.deleteProfileImage);
|
fd.append("deleteProfileImage", form.deleteProfileImage);
|
||||||
|
|
||||||
const res = await axiosInstance.post(`/auth/user/${user._id}`, fd, {
|
const res = await axiosInstance.put(`/auth/user/${user._id}`, fd, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
"Content-Type": "multipart/form-data",
|
"Content-Type": "multipart/form-data",
|
||||||
@@ -185,9 +185,7 @@ const handleForgotRejected = (state, action) => {
|
|||||||
const handleNewPasswordRejected = (state, action) => {
|
const handleNewPasswordRejected = (state, action) => {
|
||||||
state.isLoading = false;
|
state.isLoading = false;
|
||||||
state.success = false;
|
state.success = false;
|
||||||
state.msg = action.payload
|
state.msg = action.payload ? action.payload.msg : "Failed to reset password.";
|
||||||
? action.payload.msg
|
|
||||||
: "Failed to reset password.";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const authSlice = createSlice({
|
const authSlice = createSlice({
|
||||||
|
|||||||
@@ -77,9 +77,9 @@ export const updateUptimeMonitor = createAsyncThunk(
|
|||||||
name: monitor.name,
|
name: monitor.name,
|
||||||
description: monitor.description,
|
description: monitor.description,
|
||||||
interval: monitor.interval,
|
interval: monitor.interval,
|
||||||
notifications: monitor.notifications
|
notifications: monitor.notifications,
|
||||||
};
|
};
|
||||||
const res = await axiosInstance.post(
|
const res = await axiosInstance.put(
|
||||||
`/monitors/edit/${monitor._id}`,
|
`/monitors/edit/${monitor._id}`,
|
||||||
updatedFields,
|
updatedFields,
|
||||||
{
|
{
|
||||||
@@ -104,16 +104,12 @@ export const deleteUptimeMonitor = createAsyncThunk(
|
|||||||
async (data, thunkApi) => {
|
async (data, thunkApi) => {
|
||||||
try {
|
try {
|
||||||
const { authToken, monitor } = data;
|
const { authToken, monitor } = data;
|
||||||
const res = await axiosInstance.post(
|
const res = await axiosInstance.delete(`/monitors/${monitor._id}`, {
|
||||||
`/monitors/delete/${monitor._id}`,
|
headers: {
|
||||||
{},
|
Authorization: `Bearer ${authToken}`,
|
||||||
{
|
"Content-Type": "application/json",
|
||||||
headers: {
|
},
|
||||||
Authorization: `Bearer ${authToken}`,
|
});
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return res.data;
|
return res.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.response && error.response.data) {
|
if (error.response && error.response.data) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const {
|
|||||||
//Auth routes
|
//Auth routes
|
||||||
router.post("/register", upload.single("profileImage"), registerController);
|
router.post("/register", upload.single("profileImage"), registerController);
|
||||||
router.post("/login", loginController);
|
router.post("/login", loginController);
|
||||||
router.post(
|
router.put(
|
||||||
"/user/:userId",
|
"/user/:userId",
|
||||||
upload.single("profileImage"),
|
upload.single("profileImage"),
|
||||||
verifyJWT,
|
verifyJWT,
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ router.get("/:monitorId", monitorController.getMonitorById);
|
|||||||
router.get("/user/:userId", monitorController.getMonitorsByUserId);
|
router.get("/user/:userId", monitorController.getMonitorsByUserId);
|
||||||
|
|
||||||
router.post("/", monitorController.createMonitor);
|
router.post("/", monitorController.createMonitor);
|
||||||
router.post(
|
router.delete(
|
||||||
"/delete/:monitorId",
|
"/:monitorId",
|
||||||
verifyOwnership(Monitor, "monitorId"),
|
verifyOwnership(Monitor, "monitorId"),
|
||||||
monitorController.deleteMonitor
|
monitorController.deleteMonitor
|
||||||
);
|
);
|
||||||
router.post(
|
router.put(
|
||||||
"/edit/:monitorId",
|
"/edit/:monitorId",
|
||||||
verifyOwnership(Monitor, "monitorId"),
|
verifyOwnership(Monitor, "monitorId"),
|
||||||
monitorController.editMonitor
|
monitorController.editMonitor
|
||||||
|
|||||||
Reference in new issue
Block a user