mirror of https://github.com/buster-so/buster.git
move from hooks
This commit is contained in:
parent
cbcd6fccb5
commit
265104ff67
|
@ -1,5 +1,5 @@
|
||||||
import { ResetEmailForm } from '@/components/features/auth/ResetEmailForm';
|
import { ResetEmailForm } from '@/components/features/auth/ResetEmailForm';
|
||||||
import { resetPasswordEmailSend } from '@/hooks/supabaseAuthMethods';
|
import { resetPasswordEmailSend } from '@/server_context/supabaseAuthMethods';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
export default function ResetPassword(p: { searchParams: { email: string } }) {
|
export default function ResetPassword(p: { searchParams: { email: string } }) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { resetPassword } from '@/hooks/supabaseAuthMethods';
|
import { resetPassword } from '@/server_context/supabaseAuthMethods';
|
||||||
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';
|
||||||
|
|
|
@ -20,7 +20,7 @@ import {
|
||||||
signInWithGithub,
|
signInWithGithub,
|
||||||
signInWithGoogle,
|
signInWithGoogle,
|
||||||
signUp
|
signUp
|
||||||
} from '@/hooks/supabaseAuthMethods';
|
} from '@/server_context/supabaseAuthMethods';
|
||||||
import { StatusCard } from '@/components/ui/card/StatusCard';
|
import { StatusCard } from '@/components/ui/card/StatusCard';
|
||||||
import { SuccessCard } from '@/components/ui/card/SuccessCard';
|
import { SuccessCard } from '@/components/ui/card/SuccessCard';
|
||||||
|
|
||||||
|
|
|
@ -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/supabaseAuthMethods';
|
import { signOut } from '@/server_context/supabaseAuthMethods';
|
||||||
|
|
||||||
export const SidebarUserFooter: React.FC<{}> = () => {
|
export const SidebarUserFooter: React.FC<{}> = () => {
|
||||||
const user = useUserConfigContextSelector((x) => x.user);
|
const user = useUserConfigContextSelector((x) => x.user);
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { redirect } from 'next/navigation';
|
||||||
import { BusterRoutes, createBusterRoute } from '@/routes';
|
import { BusterRoutes, createBusterRoute } from '@/routes';
|
||||||
import { AppPasswordAccess } from '@controllers/AppPasswordAccess';
|
import { AppPasswordAccess } from '@controllers/AppPasswordAccess';
|
||||||
import { AppNoPageAccess } from '@controllers/AppNoPageAccess';
|
import { AppNoPageAccess } from '@controllers/AppNoPageAccess';
|
||||||
import { signInWithAnonymousUser } from '@/hooks/supabaseAuthMethods';
|
import { signInWithAnonymousUser } from '@/server_context/supabaseAuthMethods';
|
||||||
|
|
||||||
export type AppAssetCheckLayoutProps = {
|
export type AppAssetCheckLayoutProps = {
|
||||||
metricId?: string;
|
metricId?: string;
|
||||||
|
|
|
@ -3,12 +3,10 @@
|
||||||
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';
|
||||||
import Cookies from 'js-cookie';
|
|
||||||
import { QueryClient } from '@tanstack/react-query';
|
|
||||||
|
|
||||||
export const signOut = async () => {
|
export const signOut = async () => {
|
||||||
|
'use server';
|
||||||
const supabase = await createClient();
|
const supabase = await createClient();
|
||||||
const queryClient = new QueryClient();
|
|
||||||
|
|
||||||
const { error } = await supabase.auth.signOut();
|
const { error } = await supabase.auth.signOut();
|
||||||
|
|
||||||
|
@ -16,13 +14,6 @@ export const signOut = async () => {
|
||||||
return { error: error.message };
|
return { error: error.message };
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
Object.keys(Cookies.get()).forEach((cookieName) => {
|
|
||||||
Cookies.remove(cookieName);
|
|
||||||
});
|
|
||||||
queryClient.clear();
|
|
||||||
}, 650);
|
|
||||||
|
|
||||||
return redirect(
|
return redirect(
|
||||||
createBusterRoute({
|
createBusterRoute({
|
||||||
route: BusterRoutes.AUTH_LOGIN
|
route: BusterRoutes.AUTH_LOGIN
|
Loading…
Reference in New Issue