Skip to content

Commit

Permalink
Merge pull request #18 from Al0olo/feat/userManagement
Browse files Browse the repository at this point in the history
optimizing the performance
  • Loading branch information
Al0olo authored Aug 15, 2024
2 parents 1d58032 + b503765 commit 8c76ba2
Show file tree
Hide file tree
Showing 14 changed files with 564 additions and 582 deletions.
36 changes: 18 additions & 18 deletions src/Layouts/LayoutMenuData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,24 +213,24 @@ const Navdata = () => {
parentId: "apps",
stateVariables: isEcommerce,
childItems: [
{
id: 1,
label: "Models",
link: "/apps-ecommerce-models",
parentId: "apps",
},
{
id: 2,
label: "Model Details",
link: "/apps-ecommerce-model-details",
parentId: "apps",
},
{
id: 3,
label: "Create model",
link: "/apps-ecommerce-add-model",
parentId: "apps",
},
// {
// id: 1,
// label: "Models",
// link: "/apps-ecommerce-models",
// parentId: "apps",
// },
// {
// id: 2,
// label: "Model Details",
// link: "/apps-ecommerce-model-details",
// parentId: "apps",
// },
// {
// id: 3,
// label: "Create model",
// link: "/apps-ecommerce-add-model",
// parentId: "apps",
// },
// {
// id: 4,
// label: "Products",
Expand Down
9 changes: 2 additions & 7 deletions src/helpers/api_helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ AxiosInstance.interceptors.response.use(
return Promise.reject("Network error or server is not responding.");
}

console.error("Request failed:", error.response.status);

let message;
switch (error.response.status) {
case 500:
message = "Internal Server Error";
break;
case 400:
message = "Invalid credentials";
message = error.response?.data?.message;
break;
case 404:
message = "Sorry! The data you are looking for could not be found";
Expand All @@ -67,9 +65,7 @@ AxiosInstance.interceptors.response.use(
const setAuthorization = (token: string) => {
if (token) {
// sessionStorage.setItem("token", token);
AxiosInstance.defaults.headers.common[
"Authorization"
] = `Bearer ${token}`;
AxiosInstance.defaults.headers.common["Authorization"] = `Bearer ${token}`;
} else {
delete AxiosInstance.defaults.headers.common["Authorization"];
sessionStorage.removeItem("authUser");
Expand Down Expand Up @@ -120,4 +116,3 @@ const getLoggedinUser = () => {
};

export { APIClient, getLoggedinUser, removeAuthorization, setAuthorization };

14 changes: 1 addition & 13 deletions src/helpers/fakebackend_helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const addBox = (data: any) => {
};
// Update Exsiting Box
export const updateBox = (data: any) => {
return api.get(url.UPDATE_BOX, data);
return api.update(`${url.UPDATE_BOX}/${data.id}`, data);
};
// Delete Box
export const deleteBox = (data: any) => {
Expand Down Expand Up @@ -76,18 +76,6 @@ export const updateBoxGeneration = (data: any) => {
export const deleteBoxGeneration = (data: any) => {
return api.delete(`${url.DELETE_BOX_GENERATION}/${data}`);
};
// update has outside camera
export const updateHasOutSideCameraApi = (data: any) => {
return api.update(url.UPDATE_HAS_OUTSIDE_CAMERA + `/${data.id}`, data);
};
// update has inside camera
export const updateHasInSideCameraApi = (data: any) => {
return api.update(url.UPDATE_HAS_INSIDE_CAMERA + `/${data.id}`, data);
};
// update has outside camera
export const updateHasTabletApi = (data: any) => {
return api.update(url.UPDATE_HAS_TABLET + `/${data.id}`, data);
};

// ADDRESS
// Get Addresses
Expand Down
6 changes: 0 additions & 6 deletions src/helpers/url_helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,7 @@ export const GET_ONE_BOX_GENERATION = "/box-generation/get-one";
export const ADD_BOX_GENERATION = "/box-generation/new";
export const UPDATE_BOX_GENERATION = "/box-generation/update";
export const DELETE_BOX_GENERATION = "/box-generation/delete";
export const UPDATE_HAS_OUTSIDE_CAMERA =
"/box-generation/update-has-outside-camera-status";
export const UPDATE_HAS_INSIDE_CAMERA =
"/box-generation/update-has-inside-camera-status";
export const UPDATE_HAS_TABLET = "/box-generation/update-has-tablet-status";

// ADDRESS
export const GET_ADDRESS = "/address/get-all";
export const GET_ONE_ADDRESS = "/address/get-one";
export const ADD_ADDRESS = "/address/new";
Expand Down
Loading

0 comments on commit 8c76ba2

Please sign in to comment.