update some provider info

This commit is contained in:
Nate Kelley 2025-03-04 10:12:00 -07:00
parent 50114dfa87
commit 24eb020566
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
10 changed files with 51 additions and 47 deletions

View File

@ -1,7 +1,9 @@
'use client'; 'use client';
import React, { useMemo, useState } from 'react'; import React, { useMemo, useState } from 'react';
import { Button, Divider, Input, Result } from 'antd'; import { Result } from 'antd';
import { Input } from '@/components/ui/inputs';
import { Button } from '@/components/ui/buttons';
import { User } from '@supabase/auth-js'; import { User } from '@supabase/auth-js';
import { inputHasText, isValidEmail } from '@/lib'; import { inputHasText, isValidEmail } from '@/lib';
import { useKeyPress, useMemoizedFn } from 'ahooks'; import { useKeyPress, useMemoizedFn } from 'ahooks';
@ -11,7 +13,7 @@ import { BsGithub, BsGoogle, BsMicrosoft } from 'react-icons/bs';
import { createStyles } from 'antd-style'; import { createStyles } from 'antd-style';
import { Title, Text } from '@/components/ui/typography'; import { Title, Text } from '@/components/ui/typography';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { useBusterSupabaseAuthMethods } from '@/hooks/useBusterSupabaseAuthMethods'; import { useBusterSupabaseAuthMethods } from '@/hooks/useSupabaseAuthMethods/useBusterSupabaseAuthMethods';
import { PolicyCheck } from './PolicyCheck'; import { PolicyCheck } from './PolicyCheck';
import { rustErrorHandler } from '@/api/buster_rest/errors'; import { rustErrorHandler } from '@/api/buster_rest/errors';
@ -188,8 +190,6 @@ const LoginOptions: React.FC<{
setErrorMessages, setErrorMessages,
signUpFlow signUpFlow
}) => { }) => {
const { styles, cx } = useStyles();
const [email, setEmail] = useState(''); const [email, setEmail] = useState('');
const [password, setPassword] = useState(''); const [password, setPassword] = useState('');
const [password2, setPassword2] = useState(''); const [password2, setPassword2] = useState('');
@ -232,8 +232,7 @@ const LoginOptions: React.FC<{
}); });
}}> }}>
<Button <Button
type={'default'} prefix={<BsGoogle size={12} />}
icon={<BsGoogle size={12} />}
onClick={() => { onClick={() => {
clearAllCookies(); clearAllCookies();
onSignInWithGoogle(); onSignInWithGoogle();
@ -243,8 +242,7 @@ const LoginOptions: React.FC<{
{hasUser ? `Continue with Google` : `Sign up with Google`} {hasUser ? `Continue with Google` : `Sign up with Google`}
</Button> </Button>
<Button <Button
type={'default'} prefix={<BsGithub size={12} />}
icon={<BsGithub size={12} />}
onClick={() => { onClick={() => {
clearAllCookies(); clearAllCookies();
onSignInWithGithub(); onSignInWithGithub();
@ -254,8 +252,7 @@ const LoginOptions: React.FC<{
{hasUser ? `Continue with Github` : `Sign up with Github`} {hasUser ? `Continue with Github` : `Sign up with Github`}
</Button> </Button>
<Button <Button
type={'default'} prefix={<BsMicrosoft size={12} />}
icon={<BsMicrosoft size={12} />}
onClick={() => { onClick={() => {
clearAllCookies(); clearAllCookies();
onSignInWithAzure(); onSignInWithAzure();
@ -265,7 +262,7 @@ const LoginOptions: React.FC<{
{hasUser ? `Continue with Azure` : `Sign up with Azure`} {hasUser ? `Continue with Azure` : `Sign up with Azure`}
</Button> </Button>
<Divider plain>or</Divider> <div className="bg-border my-2 h-[0.px] w-full" />
<div> <div>
<Input <Input
@ -325,9 +322,9 @@ const LoginOptions: React.FC<{
placement="top"> placement="top">
<Button <Button
block={true} block={true}
htmlType="submit" type="submit"
loading={loading === 'email'} loading={loading === 'email'}
type="primary" variant="primary"
disabled={hasUser ? false : disableSubmitButton}> disabled={hasUser ? false : disableSubmitButton}>
{hasUser ? `Sign in` : `Sign up`} {hasUser ? `Sign in` : `Sign up`}
</Button> </Button>
@ -361,7 +358,7 @@ const SignUpSuccess: React.FC<{
extra={[ extra={[
<Button <Button
key="login" key="login"
type="primary" variant="primary"
onClick={() => { onClick={() => {
setSignUpSuccess(false); setSignUpSuccess(false);
setSignUpFlow(true); setSignUpFlow(true);

View File

@ -1,5 +1,5 @@
import { LoginForm } from '@/app/auth/_LoginComponents/LoginForm'; import { LoginForm } from '@/app/auth/_LoginComponents/LoginForm';
import { useBusterSupabaseAuthMethods } from '@/hooks/useBusterSupabaseAuthMethods'; import { useBusterSupabaseAuthMethods } from '@/hooks/useSupabaseAuthMethods/useBusterSupabaseAuthMethods';
import { redirect } from 'next/navigation'; import { redirect } from 'next/navigation';
import { BusterRoutes, createBusterRoute } from '@/routes'; import { BusterRoutes, createBusterRoute } from '@/routes';
import { useSupabaseServerContext } from '@/context/Supabase/useSupabaseContext'; import { useSupabaseServerContext } from '@/context/Supabase/useSupabaseContext';
@ -14,6 +14,7 @@ export default async function Login({}: {}) {
signInWithAzure, signInWithAzure,
signUp signUp
} = useBusterSupabaseAuthMethods(); } = useBusterSupabaseAuthMethods();
if (user?.id) { if (user?.id) {
return redirect( return redirect(
createBusterRoute({ createBusterRoute({

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { useBusterSupabaseAuthMethods } from '@/hooks/useBusterSupabaseAuthMethods'; import { useBusterSupabaseAuthMethods } from '@/hooks/useSupabaseAuthMethods/useBusterSupabaseAuthMethods';
import { ResetEmailForm } from './_ResetEmailForm'; import { ResetEmailForm } from './_ResetEmailForm';
export default function ResetPassword(p: { searchParams: { email: string } }) { export default function ResetPassword(p: { searchParams: { email: string } }) {

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { ResetPasswordForm } from './_ResetPasswordForm'; import { ResetPasswordForm } from './_ResetPasswordForm';
import { useBusterSupabaseAuthMethods } from '@/hooks/useBusterSupabaseAuthMethods'; import { useBusterSupabaseAuthMethods } from '@/hooks/useSupabaseAuthMethods/useBusterSupabaseAuthMethods';
import { redirect } from 'next/navigation'; import { redirect } from 'next/navigation';
import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes'; import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes';
import { useSupabaseServerContext } from '@/context/Supabase/useSupabaseContext'; import { useSupabaseServerContext } from '@/context/Supabase/useSupabaseContext';

View File

@ -15,7 +15,7 @@ import { BUSTER_DOCS_URL } from '@/routes/externalRoutes';
import { type DropdownProps, Dropdown } from '@/components/ui/dropdown/Dropdown'; import { type DropdownProps, Dropdown } from '@/components/ui/dropdown/Dropdown';
import { AvatarUserButton } from '@/components/ui/avatar/AvatarUserButton'; import { AvatarUserButton } from '@/components/ui/avatar/AvatarUserButton';
import { useUserConfigContextSelector } from '@/context/Users'; import { useUserConfigContextSelector } from '@/context/Users';
import { signOut } from '@/hooks/useBusterSupabaseAuthMethods'; import { signOut } from '@/hooks/useSupabaseAuthMethods/useBusterSupabaseAuthMethods';
export const SidebarUserFooter: React.FC<{}> = () => { export const SidebarUserFooter: React.FC<{}> = () => {
const user = useUserConfigContextSelector((x) => x.user); const user = useUserConfigContextSelector((x) => x.user);

View File

@ -50,7 +50,6 @@ export const useBusterNewChat = () => {
callback: initializeNewChatCallback callback: initializeNewChatCallback
} }
}); });
console.log('res', res);
busterSocket.once({ busterSocket.once({
route: '/chats/post:complete', route: '/chats/post:complete',

View File

@ -0,0 +1,2 @@
export * from './useBusterSupabaseAuthMethods';
export * from './signOut';

View File

@ -0,0 +1,32 @@
'use server';
import { createClient } from '@/context/Supabase/server';
import { createBusterRoute, BusterRoutes } from '@/routes';
import { QueryClient } from '@tanstack/react-query';
import Cookies from 'js-cookie';
import { redirect } from 'next/navigation';
export const signOut = async () => {
'use server';
const supabase = await createClient();
const queryClient = new QueryClient();
const { error } = await supabase.auth.signOut();
if (error) {
return { error: error.message };
}
setTimeout(() => {
Object.keys(Cookies.get()).forEach((cookieName) => {
Cookies.remove(cookieName);
});
queryClient.clear();
}, 650);
return redirect(
createBusterRoute({
route: BusterRoutes.AUTH_LOGIN
})
);
};

View File

@ -1,5 +1,3 @@
'use server';
import { createClient } from '@/context/Supabase/server'; import { createClient } from '@/context/Supabase/server';
import { redirect } from 'next/navigation'; import { redirect } from 'next/navigation';
import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes/busterRoutes'; import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes/busterRoutes';
@ -21,7 +19,6 @@ export const useBusterSupabaseAuthMethods = () => {
password: string; password: string;
}) => { }) => {
'use server'; 'use server';
const supabase = await createClient(); const supabase = await createClient();
const { data, error } = await supabase.auth.signInWithPassword({ const { data, error } = await supabase.auth.signInWithPassword({
@ -207,27 +204,3 @@ export const useBusterSupabaseAuthMethods = () => {
resetPasswordEmailSend resetPasswordEmailSend
}; };
}; };
export const signOut = async () => {
const supabase = await createClient();
const queryClient = new QueryClient();
const { error } = await supabase.auth.signOut();
if (error) {
return { error: error.message };
}
setTimeout(() => {
Object.keys(Cookies.get()).forEach((cookieName) => {
Cookies.remove(cookieName);
});
queryClient.clear();
}, 650);
return redirect(
createBusterRoute({
route: BusterRoutes.AUTH_LOGIN
})
);
};

View File

@ -2,7 +2,7 @@ import React from 'react';
import { getAssetCheck } from '@/api/buster_rest/assets/requests'; import { getAssetCheck } from '@/api/buster_rest/assets/requests';
import { useSupabaseServerContext } from '@/context/Supabase/useSupabaseContext'; import { useSupabaseServerContext } from '@/context/Supabase/useSupabaseContext';
import { ShareAssetType } from '@/api/asset_interfaces'; import { ShareAssetType } from '@/api/asset_interfaces';
import { useBusterSupabaseAuthMethods } from '@/hooks/useBusterSupabaseAuthMethods'; import { useBusterSupabaseAuthMethods } from '@/hooks/useSupabaseAuthMethods/useBusterSupabaseAuthMethods';
import { ClientSideAnonCheck } from './ClientSideAnonCheck'; import { ClientSideAnonCheck } from './ClientSideAnonCheck';
import { redirect } from 'next/navigation'; import { redirect } from 'next/navigation';
import { BusterRoutes, createBusterRoute } from '@/routes'; import { BusterRoutes, createBusterRoute } from '@/routes';