Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions src/pages/DocsPage/screens/DocsPage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useState, useRef } from "react";
import { Menu, X } from "lucide-react";
import axios from "axios";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import { CopyButton } from "../components/CopyButton";
Expand Down Expand Up @@ -57,10 +58,9 @@ export default function DocsPage() {
useEffect(() => {
async function fetchDocFiles() {
try {
const res = await fetch(
const { data } = await axios.get(
`https://api.github.com/repos/${GITHUB_USERNAME}/${REPO_NAME}/contents/docs?ref=${DOCS_BRANCH}&t=${Date.now()}`
);
const data = await res.json();
const mdFiles = Array.isArray(data)
? data
.filter((f) => f.name.endsWith(".md"))
Expand Down Expand Up @@ -153,10 +153,10 @@ export default function DocsPage() {

async function fetchMarkdown(fileName) {
try {
const res = await fetch(
`https://raw.githubusercontent.com/${GITHUB_USERNAME}/${REPO_NAME}/${DOCS_BRANCH}/docs/${fileName}?t=${Date.now()}`
const { data: md } = await axios.get(
`https://raw.githubusercontent.com/${GITHUB_USERNAME}/${REPO_NAME}/${DOCS_BRANCH}/docs/${fileName}?t=${Date.now()}`,
{ responseType: "text" }
);
const md = await res.text();
if (cancelled) return;
setContent(md);

Expand Down
5 changes: 2 additions & 3 deletions src/pages/OrganizationPage/components/PersonsTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ const PersonsTab = ({ selectedDate }) => {
try {
setLoading(true);

const resPersonsResponse = await api.fetchActiveRelationsForMinistry(
const resPersons = await api.fetchActiveRelationsForMinistry(
selectedDate,
selectedMinistry,
"AS_APPOINTED"
);
const resPersons = await resPersonsResponse.json();
) || [];

const personMap = new Map();
resPersons.forEach(
Expand Down
10 changes: 4 additions & 6 deletions src/pages/SplashPage/screens/dataLoadingAnimatedComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ export default function DataLoadingAnimatedComponent({ mode }) {

const fetchPersonData = async () => {
try {
const personResponse = await api.fetchAllPersons();
const personList = await personResponse.json();
const personList = await api.fetchAllPersons();
//dispatch(setAllPerson(personList.body));
const personDict = listToDict(personList.body);
dispatch(setAllPerson(personDict));
Expand Down Expand Up @@ -142,8 +141,7 @@ export default function DataLoadingAnimatedComponent({ mode }) {

const fetchAllDepartmentData = async () => {
try {
const response = await api.fetchAllDepartments();
const departmentList = await response.json();
const departmentList = await api.fetchAllDepartments();
const departmentDict = listToDict(departmentList.body);
dispatch(setAllDepartmentData(departmentDict));
} catch (e) {
Expand All @@ -159,8 +157,8 @@ export default function DataLoadingAnimatedComponent({ mode }) {
api.fetchAllCabinetMinistries(),
]);

const stateData = await stateRes.json();
const cabinetData = await cabinetRes.json();
const stateData = stateRes;
const cabinetData = cabinetRes;

const stateDict = listToDict(stateData.body);
const cabinetDict = listToDict(cabinetData.body);
Expand Down
Loading