Skip to content

Commit

Permalink
update login redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
nyatindopatrick committed Oct 14, 2024
1 parent da75cd4 commit 7a2ad4b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_SERVER_BASE_URL=https://chanjoke.intellisoftkenya.com
VITE_SERVER_BASE_URL=https://openchanjotest.intellisoftkenya.com
20 changes: 12 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,20 @@ jobs:
echo "Error: Docker login failed"
exit 1
fi
docker pull --quiet \$IMAGE_NAME
if [ \$? -ne 0 ]; then
echo "Error: Failed to pull Docker image \$IMAGE_NAME"
exit 1
if [ "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production' || 'Dev') }}" == "Dev" ]; then
cd /opt/ChanjoKe-HIE/hie
else
cd /opt/chanjoke-hie/hie
fi
sudo docker run -d --name \$CONTAINER_NAME -p 8098:3000 \$IMAGE_NAME
sudo docker compose pull client
# recreate the client service with the new image
sudo docker compose up -d client --force-recreate
sudo docker logout
echo "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production' || 'Dev') }} deployment completed successfully"
EOF
rm -f private_key
rm -f private_key
9 changes: 4 additions & 5 deletions src/pages/Login.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import MOHLogo from "../assets/nav-logo.png";
import { LockOutlined, UserOutlined, WarningTwoTone } from "@ant-design/icons";
import { Link, useNavigate } from "react-router-dom";
import { Button, Form, Input } from "antd";
import { useState } from "react";
import { Button, Input, Form, Row, Col } from "antd";
import { Link } from "react-router-dom";
import { useApiRequest } from "../api/useApi";
import MOHLogo from "../assets/nav-logo.png";

export default function Login() {
const [loading, setLoading] = useState(false);
const [loginError, setLoginError] = useState(false);

const navigation = useNavigate();
const { post, get } = useApiRequest();
const [form] = Form.useForm();

Expand All @@ -31,7 +30,7 @@ export default function Login() {

localStorage.setItem("user", JSON.stringify(userData?.user));

navigation("/");
window.location.href = "/";
}
} catch (e) {
console.log({ e });
Expand Down
1 change: 1 addition & 0 deletions src/pages/VaccinationSchedule.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default function VaccinationSchedule() {
immunizations,
fetchPatientImmunizations,
} = useImmunization()

const user = JSON.parse(localStorage.getItem('user'))

const [vaccineSchedules, setVaccineSchedules] = useState([])
Expand Down

0 comments on commit 7a2ad4b

Please sign in to comment.