Skip to content

Commit

Permalink
chore: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Oct 16, 2024
1 parent ac4e1ec commit e23ac7f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion frontend/src/components/ExternalLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ type Props = {
};

export default function ExternalLink({ to, className, children }: Props) {
const isHttpMode = window.location.protocol.startsWith("http");
const isHttpMode =
window.location.hostname !== "wails.localhost" &&
window.location.protocol.startsWith("http");

return isHttpMode ? (
<Link
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/components/layouts/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,19 @@ export default function AppLayout() {
deleteAuthToken();
await refetchInfo();

const isHttpMode = window.location.protocol.startsWith("http");
const isHttpMode =
window.location.hostname !== "wails.localhost" &&
window.location.protocol.startsWith("http");
if (isHttpMode) {
window.location.href = "/logout";
} else {
navigate("/", { replace: true });
}
}, [navigate, refetchInfo]);

const isHttpMode = window.location.protocol.startsWith("http");
const isHttpMode =
window.location.hostname !== "wails.localhost" &&
window.location.protocol.startsWith("http");

if (!info) {
return null;
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/screens/BackupNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export function BackupNode() {
const onSubmitPassword = async (e: React.FormEvent) => {
e.preventDefault();

const isHttpMode = window.location.protocol.startsWith("http");
const isHttpMode =
window.location.hostname !== "wails.localhost" &&
window.location.protocol.startsWith("http");

try {
setLoading(true);
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/screens/setup/RestoreNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export function RestoreNode() {
const [loading, setLoading] = useState(false);
const [restored, setRestored] = useState(false);
const { data: info } = useInfo(restored);
const isHttpMode = window.location.protocol.startsWith("http");
const isHttpMode =
window.location.hostname !== "wails.localhost" &&
window.location.protocol.startsWith("http");

React.useEffect(() => {
if (restored && info?.setupCompleted) {
Expand Down

0 comments on commit e23ac7f

Please sign in to comment.