Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hmunish committed Nov 4, 2023
1 parent 8d89921 commit bc2612d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/redux/reservations/reservationSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@ export const getReservations = createAsyncThunk(
try {
const response = await axios.get(
`${API_URL}/users/${userId}/reservations`,
{ headers: { Authorization: getLocalStorageAuth() } }
{ headers: { Authorization: getLocalStorageAuth() } },
);
if (response.status !== 200) throw new Error("Error");
return response.data;
} catch (err) {
return thunkAPI.rejectWithValue("Error fetching reservations");
}
}
},
);

export const addReservation = createAsyncThunk(
"reservation/addReservation",
async ({ userId, bookingDate: date, location, carId }, thunkAPI) => {
async ({
userId, bookingDate: date, location, carId,
}, thunkAPI) => {
try {
const res = await axios.post(
`${API_URL}/users/${userId}/reservations`,
Expand All @@ -42,14 +44,14 @@ export const addReservation = createAsyncThunk(
"Content-Type": "multipart/form-data",
Authorization: getLocalStorageAuth(),
},
}
},
);
if (res.status !== 201) throw new Error("Error");
return res;
} catch (err) {
return thunkAPI.rejectWithValue("Error adding reservation");
}
}
},
);

export const reservationSlice = createSlice({
Expand Down

0 comments on commit bc2612d

Please sign in to comment.