Skip to content

Commit 1cbe792

Browse files
committed
Fix next-auth paths and envs
1 parent 3b167ff commit 1cbe792

9 files changed

Lines changed: 19 additions & 27 deletions

File tree

apps/web/Dockerfile

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,9 @@ COPY --from=prepare /app/out/full/ .
2121
ARG NEXT_PUBLIC_API_URL
2222
ARG NEXT_PUBLIC_WEBSOCKET_URL
2323
ARG NEXT_PUBLIC_R2_BUCKET_URL
24-
ARG API_URL
25-
ARG NEXTAUTH_SECRET
26-
ARG NEXTAUTH_URL
27-
ARG VATSIM_CLIENT_ID
28-
ARG VATSIM_CLIENT_SECRET
29-
ARG VATSIM_AUTH_URL
3024
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
3125
ENV NEXT_PUBLIC_WEBSOCKET_URL=$NEXT_PUBLIC_WEBSOCKET_URL
3226
ENV NEXT_PUBLIC_R2_BUCKET_URL=$NEXT_PUBLIC_R2_BUCKET_URL
33-
ENV API_URL=$API_URL
34-
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET
35-
ENV NEXTAUTH_URL=$NEXTAUTH_URL
36-
ENV VATSIM_CLIENT_ID=$VATSIM_CLIENT_ID
37-
ENV VATSIM_CLIENT_SECRET=$VATSIM_CLIENT_SECRET
38-
ENV VATSIM_AUTH_URL=$VATSIM_AUTH_URL
3927

4028
RUN npm run build
4129

File renamed without changes.

apps/web/app/globals.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ fieldset {
6868
section {
6969
padding: 5.5rem 2rem 3.5rem 2rem;
7070
flex: 1;
71-
}
71+
}

apps/web/app/providers.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ThemeProvider } from "next-themes";
55

66
export function Providers({ children }: { children: React.ReactNode }) {
77
return (
8-
<SessionProvider>
8+
<SessionProvider basePath="/auth">
99
<ThemeProvider>{children}</ThemeProvider>
1010
</SessionProvider>
1111
);

apps/web/components/Header/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import Search from "./Search";
44
import "./Header.css";
55
import Image from "next/image";
6+
import { signIn, signOut, useSession } from "next-auth/react";
67
import { useEffect, useRef, useState } from "react";
78
import simradar24Logo from "@/assets/images/simradar24_logo.svg";
89
import Navigation from "./Navigation";
9-
import { signIn, signOut, useSession } from "next-auth/react";
1010

1111
export default function Header() {
1212
const [open, setOpen] = useState(false);

apps/web/components/Loader/Loader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function Loader() {
3131

3232
const fetchUserSettings = async () => {
3333
try {
34-
const res = await fetch("/api/user/settings", { cache: "no-store" });
34+
const res = await fetch("/user/settings", { cache: "no-store" });
3535
if (!res.ok) {
3636
setStatus((prev) => ({ ...prev, initUserSettings: true }));
3737
return;

apps/web/components/Panels/Settings/SettingsPanel.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@
22

33
import { resetMap } from "@/components/Map/utils/events";
44
import "./SettingsPanel.css";
5+
import { useSession } from "next-auth/react";
56
import { useEffect, useId, useRef, useState } from "react";
67
import { HexColorPicker } from "react-colorful";
78
import { getSettingValues, useSettingsStore } from "@/storage/zustand";
89

910
export default function SettingsPanel() {
1011
const settings = useSettingsStore();
12+
const { data: session } = useSession();
1113

1214
const onClose = async () => {
13-
await fetch("/api/user/settings", {
14-
method: "POST",
15-
headers: { "Content-Type": "application/json" },
16-
body: JSON.stringify(getSettingValues(settings)),
17-
});
15+
if (session) {
16+
await fetch("/user/settings", {
17+
method: "POST",
18+
headers: { "Content-Type": "application/json" },
19+
body: JSON.stringify(getSettingValues(settings)),
20+
});
21+
}
1822
resetMap();
1923
};
2024

docker/docker-compose.prod.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ services:
6161
NEXT_PUBLIC_API_URL: "https://${DOMAIN}/api"
6262
NEXT_PUBLIC_WEBSOCKET_URL: "wss://${DOMAIN}/ws"
6363
NEXT_PUBLIC_R2_BUCKET_URL: ${NEXT_PUBLIC_R2_BUCKET_URL}
64-
API_URL: http://api:${API_PORT}
65-
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
66-
NEXTAUTH_URL: "https://${DOMAIN}"
67-
VATSIM_CLIENT_ID: ${VATSIM_CLIENT_ID}
68-
VATSIM_CLIENT_SECRET: ${VATSIM_CLIENT_SECRET}
69-
VATSIM_AUTH_URL: ${VATSIM_AUTH_URL}
7064
container_name: sr24_web
7165
restart: always
7266
environment:
7367
NODE_ENV: production
7468
HOST: ${HOST}
7569
PORT: ${WEB_PORT}
70+
API_URL: http://api:${API_PORT}
71+
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
72+
NEXTAUTH_URL: https://${DOMAIN}/auth
73+
VATSIM_CLIENT_ID: ${VATSIM_CLIENT_ID}
74+
VATSIM_CLIENT_SECRET: ${VATSIM_CLIENT_SECRET}
75+
VATSIM_AUTH_URL: ${VATSIM_AUTH_URL}
7676
networks:
7777
- traefik_proxy
7878
labels:

0 commit comments

Comments
 (0)