headersy
This commit is contained in:
@@ -144,7 +144,7 @@ export const deleteNotice = async (noticeId) => {
|
|||||||
try {
|
try {
|
||||||
const response = await axios.delete(
|
const response = await axios.delete(
|
||||||
`${API_URL}/notices/delete/${noticeId}`,
|
`${API_URL}/notices/delete/${noticeId}`,
|
||||||
{ headers }
|
{ headers: headers }
|
||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export async function toggleNoticeStatus(noticeId) {
|
|||||||
`${API_URL}/toggle/${noticeId}`,
|
`${API_URL}/toggle/${noticeId}`,
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
headers,
|
headers: headers,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
@@ -27,7 +27,7 @@ export async function getWishlist() {
|
|||||||
const headers = token ? { Authorization: `Bearer ${token}` } : {};
|
const headers = token ? { Authorization: `Bearer ${token}` } : {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`${API_URL}/`, { headers });
|
const response = await axios.get(`${API_URL}/`, { headers: headers });
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching wishlist:", error);
|
console.error("Error fetching wishlist:", error);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export const useAuthStore = create(
|
|||||||
(error.response && error.response.status === 401) ||
|
(error.response && error.response.status === 401) ||
|
||||||
error.response.status === 403
|
error.response.status === 403
|
||||||
) {
|
) {
|
||||||
|
console.warn(error.response.data);
|
||||||
set({ user_id: null, token: null, isLoading: false });
|
set({ user_id: null, token: null, isLoading: false });
|
||||||
delete axios.defaults.headers.common["Authorization"];
|
delete axios.defaults.headers.common["Authorization"];
|
||||||
router.replace("/login");
|
router.replace("/login");
|
||||||
|
|||||||
Reference in New Issue
Block a user