Skip to content

Commit cade231

Browse files
Added error boundary component
1 parent c75b936 commit cade231

File tree

6 files changed

+42
-3
lines changed

6 files changed

+42
-3
lines changed

client/src/components/routes/navbar/navBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const NavBar = props => {
8181
*/
8282
useEffect(() => {
8383
log.info(`[NavBar]: Component did update.`)
84-
84+
8585
if (!googleAuthReducer.oAuth) {
8686
window.gapi.load('client:auth2', () => {
8787
window.gapi.client.init({

server/authentication-service/src/main/java/com/ujjaval/ecommerce/authenticationservice/config/SecurityConfigurer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public AuthenticationManager authenticationManagerBean() throws Exception {
4141
@Override
4242
protected void configure(HttpSecurity httpSecurity) throws Exception {
4343
httpSecurity.csrf().disable()
44-
.authorizeRequests().antMatchers("/authenticate", "/signup").permitAll().
44+
.authorizeRequests().antMatchers("/authenticate", "/signup", "/test").permitAll().
4545
anyRequest().authenticated().and().
4646
exceptionHandling().and().sessionManagement()
4747
.sessionCreationPolicy(SessionCreationPolicy.STATELESS);

server/authentication-service/src/main/java/com/ujjaval/ecommerce/authenticationservice/controller/AuthController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public class AuthController {
4545
@Autowired
4646
private AuthDataService authDataService;
4747

48+
@GetMapping("/test")
49+
public ResponseEntity<?> test() {
50+
return ResponseEntity.ok("success");
51+
}
52+
4853
@PostMapping("/signup")
4954
public ResponseEntity<?> createAccount(
5055
@RequestBody AccountCreationRequest accountCreationRequest)

server/common-data-service/src/main/java/com/ujjaval/ecommerce/commondataservice/CommonDataServiceApplication.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
import org.springframework.cache.annotation.EnableCaching;
77
import org.springframework.context.ConfigurableApplicationContext;
88

9+
import java.io.IOException;
10+
911
@SpringBootApplication
1012
@EnableCaching
1113
public class CommonDataServiceApplication {
1214

13-
public static void main(final String[] args) {
15+
public static void main(final String[] args) throws IOException {
1416
ConfigurableApplicationContext context = SpringApplication.run(CommonDataServiceApplication.class, args);
1517
context.getBean(CommonDataController.class).fillWithTestData();
18+
context.getBean(CommonDataController.class).pingOtherServices();
1619
}
1720
}

server/common-data-service/src/main/java/com/ujjaval/ecommerce/commondataservice/controller/CommonDataController.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import org.springframework.web.bind.annotation.RequestParam;
1717
import org.springframework.web.bind.annotation.RestController;
1818

19+
import java.net.HttpURLConnection;
20+
import java.net.URL;
1921
import java.util.HashMap;
2022
import java.util.List;
2123
import java.util.Objects;
@@ -38,6 +40,30 @@ public void fillWithTestData() {
3840
}
3941
}
4042

43+
public void pingOtherServices() {
44+
if (Objects.equals(environment.getProperty("ACTIVE_PROFILE"), "prod")) {
45+
HttpURLConnection connection;
46+
47+
try {
48+
//Create connection
49+
URL url = new URL(System.getenv("AUTHENTICATION_SERVICE_URL"));
50+
connection = (HttpURLConnection) url.openConnection();
51+
connection.setRequestMethod("GET");
52+
} catch (Exception e) {
53+
System.out.println("Problem with Authentication service");
54+
}
55+
56+
try {
57+
//Create connection
58+
URL url = new URL(System.getenv("PAYMENT_SERVICE_URL"));
59+
connection = (HttpURLConnection) url.openConnection();
60+
connection.setRequestMethod("GET");
61+
} catch (Exception e) {
62+
System.out.println("Problem with Payment service");
63+
}
64+
}
65+
}
66+
4167
@GetMapping(value = "/products", params = "q")
4268
public ResponseEntity<?> getProductsByCategories(@RequestParam("q") String queryParams) {
4369

server/payment-service/src/main/java/com/ujjaval/ecommerce/paymentservice/controller/PaymentController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public class PaymentController {
2121
@Autowired
2222
private Environment env;
2323

24+
@GetMapping("/test")
25+
public ResponseEntity<?> test() {
26+
return ResponseEntity.ok("success");
27+
}
28+
2429
@PostMapping("/payment")
2530
public ResponseEntity<PaymentStatus> chargeCustomer(@RequestBody CardToken cardToken) {
2631
Stripe.apiKey = env.getProperty("STRIPE_SECRET_KEY");

0 commit comments

Comments
 (0)