Skip to content

Commit b23b63c

Browse files
authored
Fix control-plane logout bug, fix oauth redirect urls (#3656)
* initial commit * fix oauth paths as well
1 parent eb513fd commit b23b63c

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

frontend/app/src/pages/auth/components/social-auth.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Button } from '@/components/v1/ui/button';
22
import { Icons } from '@/components/v1/ui/icons';
3+
import useControlPlane from '@/hooks/use-control-plane.ts';
34
import React from 'react';
45

56
export type SocialAuthProvider = 'google' | 'github';
@@ -9,12 +10,12 @@ const PROVIDER_CONFIG: Record<
910
{ href: string; label: string; icon: React.ReactNode }
1011
> = {
1112
google: {
12-
href: '/api/v1/users/google/start',
13+
href: 'users/google/start',
1314
label: 'Google',
1415
icon: <Icons.google className="size-4" />,
1516
},
1617
github: {
17-
href: '/api/v1/users/github/start',
18+
href: 'users/github/start',
1819
label: 'GitHub',
1920
icon: <Icons.gitHub className="size-4" />,
2021
},
@@ -41,9 +42,12 @@ export function SocialAuthButton({
4142
provider: SocialAuthProvider;
4243
}) {
4344
const cfg = PROVIDER_CONFIG[provider];
44-
45+
const { isControlPlaneEnabled } = useControlPlane();
46+
const basePath = isControlPlaneEnabled
47+
? '/api/v1/control-plane/'
48+
: '/api/v1/';
4549
return (
46-
<a href={cfg.href} className="w-full">
50+
<a href={basePath + cfg.href} className="w-full">
4751
<Button
4852
variant="outline"
4953
type="button"

frontend/app/src/pages/auth/hooks/use-api-meta.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useMemo } from 'react';
77
export default function useApiMeta() {
88
const { isControlPlaneEnabled } = useControlPlane();
99
const metaQuery = useQuery({
10-
queryKey: ['metadata:get'],
10+
queryKey: ['metadata:get', isControlPlaneEnabled],
1111
queryFn: async () => {
1212
try {
1313
return await (isControlPlaneEnabled

0 commit comments

Comments
 (0)