Skip to content

Commit

Permalink
refactor: improved error handling in authActions
Browse files Browse the repository at this point in the history
  • Loading branch information
bencodes07 committed Jun 10, 2024
1 parent 36a4c97 commit 875ed77
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 345 deletions.
2 changes: 1 addition & 1 deletion src/app/dashboard/bookings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import React, { useEffect, useState } from "react";
import { deleteToken } from "@/lib/actions";
import { deleteToken } from "@/lib/authActions";
import { Input } from "@/components/ui/input";
import {
DropdownMenu,
Expand Down
2 changes: 1 addition & 1 deletion src/app/dashboard/company/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import { extractNameInitials } from "@/lib/utils";
import React from "react";
import { useRouter } from "next/navigation";
import { deleteToken } from "@/lib/actions";
import { deleteToken } from "@/lib/authActions";
import Image from "next/image";
import { useDashboardData } from "@/components/dashboard/DashboardContext";

Expand Down
2 changes: 1 addition & 1 deletion src/app/dashboard/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Button } from "@/components/ui/button";
import { LuBookCopy, LuBuilding, LuGauge, LuLayoutDashboard, LuSettings, LuUser2, LuHome } from "react-icons/lu";
import React, { Suspense, useEffect, useState } from "react";
import type { User } from "@/types";
import { getAccessToken, getUser } from "@/lib/actions";
import { getAccessToken, getUser } from "@/lib/authActions";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { cn } from "@/lib/utils";
Expand Down
2 changes: 1 addition & 1 deletion src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import React, { useEffect, useState } from "react";
import { deleteToken, getAccessToken, getUser } from "@/lib/actions";
import { deleteToken, getAccessToken, getUser } from "@/lib/authActions";
import {
DropdownMenu,
DropdownMenuContent,
Expand Down
4 changes: 2 additions & 2 deletions src/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { FaGithub, FaGoogle, FaArrowRight } from "react-icons/fa6";
import { IoLogInOutline } from "react-icons/io5";
import Image from "next/image";
import { useFormStatus, useFormState } from "react-dom";
import { loginUser } from "@/lib/actions";
import { loginUser } from "@/lib/authActions";
import cx from "classnames";
import React, { useEffect } from "react";
import { useToast } from "@/components/ui/use-toast";
Expand Down Expand Up @@ -68,7 +68,7 @@ const LoginForm = () => {
<h1 className="text-3xl font-bold text-foreground">Meetmate</h1>
</div>
<div className="flex w-[70%] max-w-screen-sm flex-col items-center justify-center rounded-lg border-2 border-primary bg-background py-11 shadow-md shadow-primary max-sm:w-[90%]">
<div className="flex h-[60%] w-[70%] max-w-[650px] flex-col items-center justify-center gap-y-4 max-sm:w-[85%]">
<div className="flex h-3/5 w-[70%] max-w-[650px] flex-col items-center justify-center gap-y-4 max-sm:w-[85%]">
<h2 className="text-3xl font-semibold">Log In</h2>
<p className="text-base">
Don&apos;t have an account yet?{" "}
Expand Down
4 changes: 2 additions & 2 deletions src/app/signup/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IoLogInOutline } from "react-icons/io5";
import Image from "next/image";
import React, { useEffect } from "react";
import { useFormState, useFormStatus } from "react-dom";
import { registerUser } from "@/lib/actions";
import { registerUser } from "@/lib/authActions";
import { useToast } from "@/components/ui/use-toast";
import cx from "classnames";
import { useRouter } from "next/navigation";
Expand Down Expand Up @@ -65,7 +65,7 @@ const SignupForm = () => {
<h1 className="text-3xl font-bold text-foreground">Meetmate</h1>
</div>
<div className="flex w-[70%] max-w-screen-sm flex-col items-center justify-center rounded-lg border-2 border-primary bg-background py-11 shadow-md shadow-primary max-sm:w-[90%]">
<div className="flex h-[60%] w-[70%] max-w-[650px] flex-col items-center justify-center gap-y-4 max-sm:w-[85%]">
<div className="flex h-3/5 w-[70%] max-w-[650px] flex-col items-center justify-center gap-y-4 max-sm:w-[85%]">
<h2 className="text-3xl font-semibold">Sign Up</h2>
<p className="text-base">
Already have an account?{" "}
Expand Down
325 changes: 0 additions & 325 deletions src/lib/actions.ts

This file was deleted.

Loading

0 comments on commit 875ed77

Please sign in to comment.