mirror of
https://github.com/netbirdio/dashboard.git
synced 2026-09-23 00:30:43 -07:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e8048dd20 | ||
|
|
97255dd882 |
No files matched your search
@@ -4,6 +4,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- "feature/**"
|
- "feature/**"
|
||||||
- main
|
- main
|
||||||
|
- debug
|
||||||
tags:
|
tags:
|
||||||
- "**"
|
- "**"
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -55,7 +56,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/Dockerfile
|
file: docker/Dockerfile
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: true
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm
|
platforms: linux/amd64,linux/arm64,linux/arm
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
@@ -34,7 +34,7 @@ const auth0AuthorityConfig: AuthorityConfiguration = {
|
|||||||
|
|
||||||
const onEvent = (configurationName: any, eventName: any, data: any) => {
|
const onEvent = (configurationName: any, eventName: any, data: any) => {
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== "production") {
|
||||||
//console.info(`oidc:${configurationName}:${eventName}`, data);
|
console.info(`oidc:${configurationName}:${eventName}`, data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { OidcSecure, useOidc } from "@axa-fr/react-oidc";
|
import { OidcSecure, useOidc } from "@axa-fr/react-oidc";
|
||||||
|
import loadConfig from "@utils/config";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
@@ -6,13 +7,18 @@ import { useEffect } from "react";
|
|||||||
type Props = {
|
type Props = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const config = loadConfig();
|
||||||
|
|
||||||
export const SecureProvider = ({ children }: Props) => {
|
export const SecureProvider = ({ children }: Props) => {
|
||||||
const { isAuthenticated, login } = useOidc();
|
const { isAuthenticated, login } = useOidc();
|
||||||
const currentPath = usePathname();
|
const currentPath = usePathname();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log("isAuthenticated", isAuthenticated);
|
||||||
if (!isAuthenticated) {
|
if (!isAuthenticated) {
|
||||||
login(currentPath);
|
console.info("Not authenticated, logging in...");
|
||||||
|
login(currentPath, { client_id: config.clientId });
|
||||||
}
|
}
|
||||||
}, [currentPath, isAuthenticated, login]);
|
}, [currentPath, isAuthenticated, login]);
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -160,11 +160,12 @@ export function useApiErrorHandling(ignoreError = false) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (err: ErrorResponse) => {
|
return (err: ErrorResponse) => {
|
||||||
|
console.info("API request error", err);
|
||||||
if (err.code == 401 && err.message == "no valid authentication provided") {
|
if (err.code == 401 && err.message == "no valid authentication provided") {
|
||||||
return login(currentPath);
|
return login(currentPath, { client_id: config.clientId });
|
||||||
}
|
}
|
||||||
if (err.code == 401 && err.message == "token expired") {
|
if (err.code == 401 && err.message == "token expired") {
|
||||||
return login(currentPath);
|
return login(currentPath, { client_id: config.clientId });
|
||||||
}
|
}
|
||||||
if (err.code == 401 && err.message == "token invalid") {
|
if (err.code == 401 && err.message == "token invalid") {
|
||||||
return setError(err);
|
return setError(err);
|
||||||
|
|||||||
Reference in new issue
Block a user