forked from baron/baron-sso
fix(devfront): add explicit button type and improve test stability
This commit is contained in:
@@ -63,8 +63,8 @@ export default defineConfig({
|
|||||||
? undefined
|
? undefined
|
||||||
: {
|
: {
|
||||||
command: process.env.CI
|
command: process.env.CI
|
||||||
? "npm run build && npm run preview -- --port 5174"
|
? "VITE_OIDC_AUTHORITY=http://localhost:5000/oidc npm run build && npm run preview -- --port 5174"
|
||||||
: "npm run dev -- --port 5174",
|
: "VITE_OIDC_AUTHORITY=http://localhost:5000/oidc npm run dev -- --port 5174",
|
||||||
url: baseURL,
|
url: baseURL,
|
||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export default function AuthGuard() {
|
|||||||
<p>{auth.error.message}</p>
|
<p>{auth.error.message}</p>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
type="button"
|
||||||
onClick={() => void auth.signinRedirect()}
|
onClick={() => void auth.signinRedirect()}
|
||||||
className="rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600"
|
className="rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -524,16 +524,17 @@ function ClientGeneralPage() {
|
|||||||
if (result?.client?.id) {
|
if (result?.client?.id) {
|
||||||
navigate(`/clients/${result.client.id}/settings`);
|
navigate(`/clients/${result.client.id}/settings`);
|
||||||
}
|
}
|
||||||
alert(t("msg.dev.clients.general.saved", "설정이 저장되었습니다."));
|
toast(t("msg.dev.clients.general.saved", "설정이 저장되었습니다."));
|
||||||
},
|
},
|
||||||
onError: (err) => {
|
onError: (err) => {
|
||||||
const axiosError = err as AxiosError<{ error?: string }>;
|
const axiosError = err as AxiosError<{ error?: string }>;
|
||||||
if (axiosError.response?.status === 403) {
|
if (axiosError.response?.status === 403) {
|
||||||
alert(
|
toast(
|
||||||
t(
|
t(
|
||||||
"msg.dev.clients.general.save_forbidden",
|
"msg.dev.clients.general.save_forbidden",
|
||||||
"이 RP 설정을 수정할 권한이 없습니다.\n관리자에게 RP 일반 설정 또는 RP 관리자 관계 부여를 요청해 주세요.",
|
"이 RP 설정을 수정할 권한이 없습니다.\n관리자에게 RP 일반 설정 또는 RP 관리자 관계 부여를 요청해 주세요.",
|
||||||
),
|
),
|
||||||
|
"error",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -542,7 +543,7 @@ function ClientGeneralPage() {
|
|||||||
axiosError.response?.data?.error ??
|
axiosError.response?.data?.error ??
|
||||||
(err as Error)?.message ??
|
(err as Error)?.message ??
|
||||||
t("msg.common.unknown_error", "unknown error");
|
t("msg.common.unknown_error", "unknown error");
|
||||||
alert(
|
toast(
|
||||||
t(
|
t(
|
||||||
"msg.dev.clients.general.save_error",
|
"msg.dev.clients.general.save_error",
|
||||||
"저장에 실패했습니다: {{error}}",
|
"저장에 실패했습니다: {{error}}",
|
||||||
@@ -550,6 +551,7 @@ function ClientGeneralPage() {
|
|||||||
error: errorMessage,
|
error: errorMessage,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
"error",
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -558,17 +560,18 @@ function ClientGeneralPage() {
|
|||||||
mutationFn: (id: string) => deleteClient(id),
|
mutationFn: (id: string) => deleteClient(id),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: ["clients"] });
|
queryClient.invalidateQueries({ queryKey: ["clients"] });
|
||||||
alert(t("msg.dev.clients.deleted", "앱이 삭제되었습니다."));
|
toast(t("msg.dev.clients.deleted", "앱이 삭제되었습니다."));
|
||||||
navigate("/clients");
|
navigate("/clients");
|
||||||
},
|
},
|
||||||
onError: (err) => {
|
onError: (err) => {
|
||||||
const errorMessage =
|
const errorMessage =
|
||||||
(err as AxiosError<{ error?: string }>).response?.data?.error ??
|
(err as AxiosError<{ error?: string }>).response?.data?.error ??
|
||||||
(err as Error)?.message;
|
(err as Error)?.message;
|
||||||
alert(
|
toast(
|
||||||
t("msg.dev.clients.delete_error", "삭제 실패: {{error}}", {
|
t("msg.dev.clients.delete_error", "삭제 실패: {{error}}", {
|
||||||
error: errorMessage,
|
error: errorMessage,
|
||||||
}),
|
}),
|
||||||
|
"error",
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|||||||
import type { AxiosError } from "axios";
|
import type { AxiosError } from "axios";
|
||||||
import { ArrowLeft, Link2, Plus, Trash2 } from "lucide-react";
|
import { ArrowLeft, Link2, Plus, Trash2 } from "lucide-react";
|
||||||
import { useDeferredValue, useMemo, useState } from "react";
|
import { useDeferredValue, useMemo, useState } from "react";
|
||||||
|
import { useAuth } from "react-oidc-context";
|
||||||
import { Link, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
import { Badge } from "../../components/ui/badge";
|
import { Badge } from "../../components/ui/badge";
|
||||||
import { Button } from "../../components/ui/button";
|
import { Button } from "../../components/ui/button";
|
||||||
@@ -33,7 +34,6 @@ import {
|
|||||||
} from "../../lib/devApi";
|
} from "../../lib/devApi";
|
||||||
import { t } from "../../lib/i18n";
|
import { t } from "../../lib/i18n";
|
||||||
import { resolveProfileRole } from "../../lib/role";
|
import { resolveProfileRole } from "../../lib/role";
|
||||||
import { useAuth } from "react-oidc-context";
|
|
||||||
import { ClientDetailTabs } from "./ClientDetailTabs";
|
import { ClientDetailTabs } from "./ClientDetailTabs";
|
||||||
|
|
||||||
const relationOptions = [
|
const relationOptions = [
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import { UserManager, WebStorageStateStore } from "oidc-client-ts";
|
|||||||
import type { AuthProviderProps } from "react-oidc-context";
|
import type { AuthProviderProps } from "react-oidc-context";
|
||||||
|
|
||||||
export const oidcConfig: AuthProviderProps = {
|
export const oidcConfig: AuthProviderProps = {
|
||||||
authority:
|
authority: import.meta.env.VITE_OIDC_AUTHORITY || "https://sso.hmac.kr/oidc", // Gateway Proxy URL
|
||||||
import.meta.env.VITE_OIDC_AUTHORITY || "https://sso.hmac.kr/oidc", // Gateway Proxy URL
|
|
||||||
client_id: import.meta.env.VITE_OIDC_CLIENT_ID || "devfront",
|
client_id: import.meta.env.VITE_OIDC_CLIENT_ID || "devfront",
|
||||||
redirect_uri: `${window.location.origin}/auth/callback`,
|
redirect_uri: `${window.location.origin}/auth/callback`,
|
||||||
response_type: "code",
|
response_type: "code",
|
||||||
|
|||||||
Reference in New Issue
Block a user