mirror of
				https://github.com/steveiliop56/tinyauth.git
				synced 2025-11-03 23:55:44 +00:00 
			
		
		
		
	refactor: use controller approach in handlers
This commit is contained in:
		@@ -15,7 +15,7 @@ export const AppContextProvider = ({
 | 
			
		||||
}) => {
 | 
			
		||||
  const { isFetching, data, error } = useSuspenseQuery({
 | 
			
		||||
    queryKey: ["app"],
 | 
			
		||||
    queryFn: () => axios.get("/api/app").then((res) => res.data),
 | 
			
		||||
    queryFn: () => axios.get("/api/context/app").then((res) => res.data),
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  if (error && !isFetching) {
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ export const UserContextProvider = ({
 | 
			
		||||
}) => {
 | 
			
		||||
  const { isFetching, data, error } = useSuspenseQuery({
 | 
			
		||||
    queryKey: ["user"],
 | 
			
		||||
    queryFn: () => axios.get("/api/user").then((res) => res.data),
 | 
			
		||||
    queryFn: () => axios.get("/api/context/user").then((res) => res.data),
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  if (error && !isFetching) {
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ export const LogoutPage = () => {
 | 
			
		||||
  const { t } = useTranslation();
 | 
			
		||||
 | 
			
		||||
  const logoutMutation = useMutation({
 | 
			
		||||
    mutationFn: () => axios.post("/api/logout"),
 | 
			
		||||
    mutationFn: () => axios.post("/api/user/logout"),
 | 
			
		||||
    mutationKey: ["logout"],
 | 
			
		||||
    onSuccess: () => {
 | 
			
		||||
      toast.success(t("logoutSuccessTitle"), {
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ export const TotpPage = () => {
 | 
			
		||||
  const redirectUri = searchParams.get("redirect_uri");
 | 
			
		||||
 | 
			
		||||
  const totpMutation = useMutation({
 | 
			
		||||
    mutationFn: (values: TotpSchema) => axios.post("/api/totp", values),
 | 
			
		||||
    mutationFn: (values: TotpSchema) => axios.post("/api/user/totp", values),
 | 
			
		||||
    mutationKey: ["totp"],
 | 
			
		||||
    onSuccess: () => {
 | 
			
		||||
      toast.success(t("totpSuccessTitle"), {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user