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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import React from 'react';
import { ResetPasswordForm } from './_ResetPasswordForm';
import { useBusterSupabaseAuthMethods } from '@/hooks/useBusterSupabaseAuthMethods';
import { useBusterSupabaseAuthMethods } from '@/hooks/useSupabaseAuthMethods/useBusterSupabaseAuthMethods';
import { redirect } from 'next/navigation';
import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes';
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 { AvatarUserButton } from '@/components/ui/avatar/AvatarUserButton';
import { useUserConfigContextSelector } from '@/context/Users';
import { signOut } from '@/hooks/useBusterSupabaseAuthMethods';
import { signOut } from '@/hooks/useSupabaseAuthMethods/useBusterSupabaseAuthMethods';
export const SidebarUserFooter: React.FC<{}> = () => {
const user = useUserConfigContextSelector((x) => x.user);

View File

@ -50,7 +50,6 @@ export const useBusterNewChat = () => {
callback: initializeNewChatCallback
}
});
console.log('res', res);
busterSocket.once({
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 { redirect } from 'next/navigation';
import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes/busterRoutes';
@ -21,7 +19,6 @@ export const useBusterSupabaseAuthMethods = () => {
password: string;
}) => {
'use server';
const supabase = await createClient();
const { data, error } = await supabase.auth.signInWithPassword({
@ -207,27 +204,3 @@ export const useBusterSupabaseAuthMethods = () => {
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 { useSupabaseServerContext } from '@/context/Supabase/useSupabaseContext';
import { ShareAssetType } from '@/api/asset_interfaces';
import { useBusterSupabaseAuthMethods } from '@/hooks/useBusterSupabaseAuthMethods';
import { useBusterSupabaseAuthMethods } from '@/hooks/useSupabaseAuthMethods/useBusterSupabaseAuthMethods';
import { ClientSideAnonCheck } from './ClientSideAnonCheck';
import { redirect } from 'next/navigation';
import { BusterRoutes, createBusterRoute } from '@/routes';