Skip to content

Commit

Permalink
Merge pull request #177 from egovernments/common-module-fixes
Browse files Browse the repository at this point in the history
added userType in common module
  • Loading branch information
nipunarora-eGov authored Feb 28, 2024
2 parents 3b542a1 + 8a1324d commit c3b83e7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions micro-ui/web/packages/common/src/CommonWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import React from 'react';
import { QueryClientProvider } from 'react-query';
import { BrowserRouter as Router } from 'react-router-dom';
import { PaymentModule } from './payments';
const App = ({ queryClient, title }) => {
const App = ({ queryClient, title,userType }) => {
return (
<QueryClientProvider client={queryClient}>
<Router>
<PaymentModule path={'/workbench-ui/employee/common'} stateCode={"pg"} cityCode={"citya"} moduleCode={"Payment"} userType={"employee"} />
<PaymentModule path={`/${window.contextPath}/${userType}/common`} stateCode={"pg"} cityCode={"citya"} moduleCode={"Payment"} userType={userType} />
</Router>
{/* <div>Common module running thru host {title}</div> */}
</QueryClientProvider>
Expand Down
4 changes: 3 additions & 1 deletion micro-ui/web/packages/common/src/payments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import EmployeePayment from "./employee";


export const PaymentModule = ({ deltaConfig = {}, stateCode, cityCode, moduleCode = "Payment", userType,path }) => {
// const {pathname:url} = useLocation()
const url = `${window.contextPath}/citizen/common/`

const {pathname:url} = useLocation()
const store = { data: {} }; //Digit.Services.useStore({}, { deltaConfig, stateCode, cityCode, moduleCode, language });

if (Object.keys(store).length === 0) {
Expand All @@ -18,6 +19,7 @@ export const PaymentModule = ({ deltaConfig = {}, stateCode, cityCode, moduleCod
}

const getPaymentHome = () => {

if (userType === "citizen") return <CitizenPayment {...{ stateCode, moduleCode, cityCode, path, url }} />;
else return <EmployeePayment {...{ stateCode, cityCode, moduleCode,path }} />;
};
Expand Down
5 changes: 4 additions & 1 deletion micro-ui/web/packages/core/src/modules/registerRemotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ export default (queryClient) => {
},
});

const userType = Digit.UserService.getType();

registerApplication({
name: "Common",
app: () => import("common/CommonModule"),
activeWhen: "/workbench-ui/employee/common",
activeWhen: `/workbench-ui/${userType}/common`, //change to userType here
customProps: {
title: "Common Module is running on host",
queryClient,
userType
},
});

Expand Down
4 changes: 2 additions & 2 deletions micro-ui/web/packages/core/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = () => {
proxy: [
{
context: () => true,
// target: 'https://unified-dev.digit.org',
// target: 'https://staging.digit.org',
target: 'https://unified-dev.digit.org',
secure: false,
changeOrigin:true,
Expand Down Expand Up @@ -47,7 +47,7 @@ module.exports = () => {
pgr: "pgr@https://localhost:8087/remoteEntry.js",
// hrms: "hrms@https://localhost:8085/remoteEntry.js",
// workbench: "workbench@https://localhost:8086/remoteEntry.js",
common:"common@https://unified-dev.digit.org/common-ui/remoteEntry.js"
common:"common@https://localhost:8090/remoteEntry.js"
// app1: "app1@https://localhost:8001/remoteEntry.js",
// dss: "dss@https://localhost:8087/remoteEntry.js",
// measurement : "measurement@https://localhost:8088/remoteEntry.js"
Expand Down

0 comments on commit c3b83e7

Please sign in to comment.