Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0ee1017
feat: drop down filter api integrated
seemachal-8848 Apr 19, 2025
5f06b5a
feat: react select package added
seemachal-8848 Apr 19, 2025
3fdb473
feat: vehicle filters api file created
seemachal-8848 Apr 21, 2025
e2b2e76
feat: check box filter with drop down functionality added
seemachal-8848 Apr 24, 2025
f4623fd
feat: auto house hubli product list page hooks added
seemachal-8848 May 16, 2025
0af8a12
Delete hooks/ProductListPageHooks/useDropDownFilterHook.ts
seemachal-8848 May 19, 2025
7c26d77
Delete hooks/WebsiteUserList/useAddMechanic.ts
seemachal-8848 May 19, 2025
e4e994f
Delete hooks/WebsiteUserList/useMechanicList.ts
seemachal-8848 May 19, 2025
4ea10b1
Delete pages/otp.tsx
seemachal-8848 May 19, 2025
3415b70
Delete pages/profile.tsx
seemachal-8848 May 19, 2025
5986706
Delete services/api/product-listing-page-apis/get-dropdown-filters-ap…
seemachal-8848 May 19, 2025
25546ea
Delete services/api/user/add-mechanic-to-user-api.ts
seemachal-8848 May 19, 2025
6f7b736
Delete services/api/user/get-mechanic-list-api.ts
seemachal-8848 May 19, 2025
5f89df8
Delete store/slices/category-breadcrumb-slice directory
seemachal-8848 May 19, 2025
860023d
Update root-reducer.ts
seemachal-8848 May 19, 2025
aae7ad3
Merge branch 'develop' into auto-house-hubli
seemachal-8848 May 19, 2025
396005a
Update useCustomerGroupList.ts
seemachal-8848 May 23, 2025
cdedd44
Update useWebsiteUserList.ts
seemachal-8848 May 23, 2025
4f2a457
Update get-customer-group-list-api.ts
seemachal-8848 May 23, 2025
f31b90e
Update get-website-user-list-api.ts
seemachal-8848 May 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hooks/AuthHooks/useLoginHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const useLoginHook = () => {
localStorage.setItem('isLoggedIn', 'true');
localStorage.setItem('user', values.usr);
localStorage.setItem('party_name', tokenData?.data?.full_name);
localStorage.setItem('user_role', JSON.stringify(tokenData?.data?.user_role));

dispatch(storeToken(tokenData?.data));
router.push('/');
Expand Down
1 change: 1 addition & 0 deletions hooks/CheckoutPageHook/useCheckout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const useCheckout = () => {
setErrMessage('Failed to place order');
} finally {
setIsLoading(false);
localStorage.setItem('otp_verified', 'false');
}
}
};
Expand Down
50 changes: 50 additions & 0 deletions hooks/CustomerGroupHook/useCustomerGroupList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { get_access_token } from '../../store/slices/auth/token-login-slice';
import { CONSTANTS } from '../../services/config/app-config';
import useHandleStateUpdate from '../GeneralHooks/handle-state-update-hook';
import getCustomerGroupListAPI from '../../services/api/customer-group-list-apis/get-customer-group-list-api';

const useCustomerGroupList = () => {
const { isLoading, setIsLoading, errorMessage, setErrMessage }: any = useHandleStateUpdate();
const { SUMMIT_APP_CONFIG }: any = CONSTANTS;
const [customerGroupList, setCustomerGroupList] = useState<any>({});
const tokenFromStore: any = useSelector(get_access_token);

const fetchCustomerGroupList: any = async () => {
let customerGroupList: any;
setIsLoading(true);

/**
* Fetches customer group list from the API using the given token.
*
* @async
* @function fetchCustomerGroupList
* @param {Object} SUMMIT_APP_CONFIG - The Summit API SDK object used to interact with the API.
* @param {string} token - The authentication token obtained from the store.
* @returns {Promise<void>} - Resolves when the API response is handled.
* @throws {Error} Throws an error if the API call fails.
*/
try {
customerGroupList = await getCustomerGroupListAPI(SUMMIT_APP_CONFIG, tokenFromStore.token);
console.log('customerGroupList', customerGroupList);
if (customerGroupList?.status === 200 && customerGroupList?.data?.message?.msg === 'success') {
setCustomerGroupList(customerGroupList?.data?.message?.data);
} else {
setErrMessage(customerGroupList?.data?.message?.error);
}
} catch (error) {
setErrMessage(customerGroupList?.data?.message?.error);
} finally {
setIsLoading(false);
}
};

useEffect(() => {
fetchCustomerGroupList();
}, []);

return { customerGroupList, isLoading, errorMessage };
};

export default useCustomerGroupList;
50 changes: 50 additions & 0 deletions hooks/WebsiteUserList/useWebsiteUserList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { get_access_token } from '../../store/slices/auth/token-login-slice';
import { CONSTANTS } from '../../services/config/app-config';
import useHandleStateUpdate from '../GeneralHooks/handle-state-update-hook';
import getWebsiteUserListAPI from '../../services/api/user/get-website-user-list-api';

const useWebsiteUserList = (type: any) => {
const { isLoading, setIsLoading, errorMessage, setErrMessage }: any = useHandleStateUpdate();
const { SUMMIT_APP_CONFIG }: any = CONSTANTS;
const [websiteUserList, setWebsiteUserList] = useState<any>({});
const tokenFromStore: any = useSelector(get_access_token);

const fetchuseWebsiteUserListList: any = async () => {
let websiteUserList: any;
setIsLoading(true);

/**
* Fetches user list from the API using the given token.
*
* @async
* @function fetchuseWebsiteUserListList
* @param {Object} SUMMIT_APP_CONFIG - The Summit API SDK object used to interact with the API.
* @param {string} token - The authentication token obtained from the store.
* @returns {Promise<void>} - Resolves when the API response is handled.
* @throws {Error} Throws an error if the API call fails.
*/
try {
websiteUserList = await getWebsiteUserListAPI(SUMMIT_APP_CONFIG, type, tokenFromStore.token);
console.log('websiteUserList', websiteUserList);
if (websiteUserList?.status === 200 && websiteUserList?.data?.message?.msg === 'success') {
setWebsiteUserList(websiteUserList?.data?.message?.data);
} else {
setErrMessage(websiteUserList?.data?.message?.error);
}
} catch (error) {
setErrMessage(websiteUserList?.data?.message?.error);
} finally {
setIsLoading(false);
}
};

useEffect(() => {
fetchuseWebsiteUserListList();
}, [type]);

return { websiteUserList, isLoading, errorMessage };
};

export default useWebsiteUserList;
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@
"react-paginate": "^8.2.0",
"react-redux": "^8.0.5",
"react-select": "^5.10.1",
"react-select-search": "^4.1.8",
"react-simple-star-rating": "^5.1.7",
"react-social-login-buttons": "^4.1.0",
"react-toastify": "^9.1.3",
"reactjs-social-login": "^2.6.3",
"redux-persist": "^6.0.0",
"swiper": "^11.2.6",
"yup": "^1.3.3"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import APP_CONFIG from '../../../interfaces/app-config-interface';
import { executeGETAPI } from '../../../utils/http-methods';

/**
* Fetches customer group list from the API using the given parameters.
*
* @async
* @function getCustomerGroupListAPI
* @param {string} appConfig - The configuration of the application.
* @param {string} token - The authentication token.
* @returns {Promise<any>} - The response from the API call.
* @throws {Error} Throws an error if the API call fails.
*/
const getCustomerGroupListAPI = async (appConfig: APP_CONFIG, token: any): Promise<any> => {
let additionalParams = {};
// Use executeGETAPI to handle GET Request logic
const response = await executeGETAPI(
appConfig,
'get-customer-group-list-api',
token,
additionalParams // Pass additional parameters if needed
);

return response;
};

export default getCustomerGroupListAPI;
17 changes: 17 additions & 0 deletions services/api/product-listing-page-apis/get-all-filters-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import APP_CONFIG from '../../../interfaces/app-config-interface';
import { executeGETAPI } from '../../../utils/http-methods';

const fetchProductListingPageALLFilters = async (appConfig: APP_CONFIG, token: any) => {
const additionalParams = {}; // Add additional parameters if needed
// Use executeGETAPI to handle GET Request logic
const response = await executeGETAPI(
appConfig,
'get-product-listing-all-filters-api',
token,
additionalParams // Pass additional parameters if needed
);

return response;
};

export default fetchProductListingPageALLFilters;
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ const fetchProductListingFromAPI = async (appName: any, query: any, token: any)
}

const category: any = query.url_params.category;
const email: any = query.url_params.email || '';

// Construct URL parameters
const urlParams = Object.keys(query.url_params)
.map((key) => {
if (key === 'filter') {
return `${key}={"${query.filterDoctype}":"${query.filterDocname}", "sections":${query.url_params.filter}}`;
} if (key === 'vehicle_filters') {
return `${key}={"${query.filterDoctype}":"${query.filterDocname}", "sections":${query.url_params.vehicle_filters}}`;
} else {
return `${key}=${encodeURIComponent(query.url_params[key])}`;
}
Expand Down Expand Up @@ -53,6 +56,7 @@ const fetchProductListingFromAPI = async (appName: any, query: any, token: any)
additionalParams = {
...additionalParams,
category,
email
};
response = await executeGETAPI(appName, 'product-list-api', token, additionalParams);
} else if (query.router_origin === 'catalog') {
Expand Down
27 changes: 27 additions & 0 deletions services/api/user/get-website-user-list-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import APP_CONFIG from '../../../interfaces/app-config-interface';
import { executeGETAPI } from '../../../utils/http-methods';

/**
* Fetches website user list from the API using the given parameters.
*
* @async
* @function getWebsiteUserListAPI
* @param {string} appConfig - The configuration of the application.
* @param {string} token - The authentication token.
* @returns {Promise<any>} - The response from the API call.
* @throws {Error} Throws an error if the API call fails.
*/
const getWebsiteUserListAPI = async (appConfig: APP_CONFIG, type: any, token: any): Promise<any> => {
let additionalParams = { customer_group: type || '' };
// Use executeGETAPI to handle GET Request logic
const response = await executeGETAPI(
appConfig,
'get-website-user-list-api',
token,
additionalParams // Pass additional parameters if needed
);

return response;
};

export default getWebsiteUserListAPI;
2 changes: 1 addition & 1 deletion store/root-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const appReducer = combineReducers({
cart: cartLocalSlice,
catalogSlice: catalogLocalSlice,
quickOrder: quickOrderSlice,
});
});

const rootReducer = (state: any, action: any) => {
if (action.type === resetStore.type) {
Expand Down
6 changes: 6 additions & 0 deletions utils/api_sdk_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ const apiSdkRegistry: any = {
'sitemap-api': { method: 'get_site_map', entity: 'seo' },
'promotional-banner-api': { method: '', entity: '' },
'blog-api': { method: 'get_blog_post_list', entity: 'blog_post' },
'get-product-listing-dropdown-filters-api': { method: 'get_vehicle_filters', entity: 'filter' },
'get-customer-group-list-api': { method: 'get_customer_group', entity: 'customer_group' },
'get-website-user-list-api': { method: 'get_website_user', entity: 'user' },
'get-mechanic-list-api': { method: 'get_mechanic', entity: 'user' },
'add-mechanic-to-user-api': { method: 'update_mechanic_in_customer', entity: 'user' },
'get-product-listing-all-filters-api': { method: 'get_filters_without_category', entity: 'filter' },
};

export default apiSdkRegistry;