Skip to content

Commit ef03784

Browse files
committed
chore: fix for no admin views and dockignore to shrink image size
1 parent e66a8ab commit ef03784

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ dist
44
Dockerfile
55
docker-compose.yml
66
*.log
7-
.env
7+
.env
8+
node_modules

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN npm run build
1212

1313
FROM nginx:alpine
1414

15-
COPY nginx.conf /etc/nginx/conf.d/default.conf
15+
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
1616
COPY --from=builder /app/dist /usr/share/nginx/html
1717

1818
COPY entrypoint.sh /entrypoint.sh

src/components/RequireAuth.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function RequireAuth({
1414
}: {
1515
children: React.ReactNode;
1616
}) {
17-
const { isAuthenticated, user } = useAuth();
17+
const { isAuthenticated, user, hasRole } = useAuth();
1818
const [ready, setReady] = useState(false);
1919

2020
useEffect(() => {
@@ -27,7 +27,7 @@ export default function RequireAuth({
2727
return <AuthLoading />;
2828
}
2929

30-
if (!isAuthenticated) {
30+
if (!isAuthenticated || !hasRole("admin")) {
3131
return <Navigate to="/unauthenticated" replace />;
3232
}
3333

src/pages/Unauthenticated.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function Unauthenticated() {
1515
return <LayoutSkeleton />;
1616
}
1717

18-
if (isAuthenticated) {
18+
if (isAuthenticated && hasRole("admin")) {
1919
return <Navigate to="/" replace />;
2020
}
2121

0 commit comments

Comments
 (0)