Skip to content

Commit

Permalink
avniproject#1140 | changed fetch api to http method and removed function
Browse files Browse the repository at this point in the history
  • Loading branch information
vedfordev committed Mar 7, 2024
1 parent e62ac9a commit f8a7587
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/rootApp/views/SignInView.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ import React, { useEffect, useState } from "react";
import SideImage from "../../avni-background.jpeg";
import { withStyles } from "@material-ui/core/styles";
import ApplicationContext from "../../ApplicationContext";

const fetchReportingSystem = async setReportingSystems => {
const data = await fetch("/Config").then(response => response.json());
data.reportingSystems && setReportingSystems(data.reportingSystems);
};
import http from "common/utils/httpClient";

function SignInView({
classes,
Expand All @@ -37,7 +33,14 @@ function SignInView({
const [reportingSystems, setReportingSystems] = useState(null);

useEffect(() => {
fetchReportingSystem(setReportingSystems);
http
.get("/Config")
.then(
response =>
response.data &&
response.data.reportingSystems &&
setReportingSystems(response.data.reportingSystems)
);
return () => {

This comment has been minimized.

Copy link
@petmongrels

petmongrels Mar 8, 2024

This not required anymore.

setReportingSystems(null);
};
Expand Down

0 comments on commit f8a7587

Please sign in to comment.