diff --git a/src/app/(auth)/AuthProvider.tsx b/src/app/(auth)/AuthProvider.tsx index e34395fd..f5b51f2a 100644 --- a/src/app/(auth)/AuthProvider.tsx +++ b/src/app/(auth)/AuthProvider.tsx @@ -5,7 +5,7 @@ import { formatInTimeZone } from "date-fns-tz"; import { clientSignIn, clientSignOut } from "@/store/features/auth/authSlice"; import { useAppDispatch } from "@/store/hooks"; import { type User, getUserState } from "@/store/features/user/userSlice"; -import { type AppError } from "@/modules/shared/types"; +import { type AppError } from "@/types/types"; import { currentDate } from "@/utils/getCurrentSprint"; interface AuthProviderProps { diff --git a/src/app/(auth)/authService.ts b/src/app/(auth)/authService.ts index d5d12121..24df5341 100644 --- a/src/app/(auth)/authService.ts +++ b/src/app/(auth)/authService.ts @@ -2,7 +2,7 @@ import { cookies } from "next/headers"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { getAccessToken, getRefreshToken } from "@/utils/getCookie"; import { POST, UNAUTHPOST } from "@/utils/requests"; diff --git a/src/app/(main)/dashboard/components/voyage-dashboard/getDashboardData.ts b/src/app/(main)/dashboard/components/voyage-dashboard/getDashboardData.ts index 30f0cfda..ecbe3e85 100644 --- a/src/app/(main)/dashboard/components/voyage-dashboard/getDashboardData.ts +++ b/src/app/(main)/dashboard/components/voyage-dashboard/getDashboardData.ts @@ -2,7 +2,8 @@ import { fetchSprints } from "@/myVoyage/sprints/components/RedirectToCurrentSpr import { fetchMeeting } from "@/myVoyage/sprints/components/SprintWrapper"; import type { User } from "@/store/features/user/userSlice"; import type { Sprint, Voyage } from "@/store/features/sprint/sprintSlice"; -import type { AppError, AsyncActionResponse } from "@/modules/shared/types"; +import { type AppError } from "@/types/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { getCurrentSprint } from "@/utils/getCurrentSprint"; import { getCurrentVoyageData } from "@/utils/getCurrentVoyageData"; import { fetchResources } from "@/app/(main)/my-voyage/[teamId]/voyage-resources/components/ResourcesComponentWrapper"; diff --git a/src/app/(main)/my-voyage/[teamId]/directory/components/DirectoryComponentWrapper.tsx b/src/app/(main)/my-voyage/[teamId]/directory/components/DirectoryComponentWrapper.tsx index a83604e5..0139b856 100644 --- a/src/app/(main)/my-voyage/[teamId]/directory/components/DirectoryComponentWrapper.tsx +++ b/src/app/(main)/my-voyage/[teamId]/directory/components/DirectoryComponentWrapper.tsx @@ -10,7 +10,7 @@ import { type TeamDirectory } from "@/store/features/directory/directorySlice"; import { getAccessToken } from "@/utils/getCookie"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { GET } from "@/utils/requests"; import { CacheTag } from "@/utils/cacheTag"; import { type User } from "@/store/features/user/userSlice"; diff --git a/src/app/(main)/my-voyage/[teamId]/directory/directoryService.ts b/src/app/(main)/my-voyage/[teamId]/directory/directoryService.ts index 1910d21c..eaf9dc43 100644 --- a/src/app/(main)/my-voyage/[teamId]/directory/directoryService.ts +++ b/src/app/(main)/my-voyage/[teamId]/directory/directoryService.ts @@ -3,7 +3,7 @@ import { revalidateTag } from "next/cache"; import { getAccessToken } from "@/utils/getCookie"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { PATCH } from "@/utils/requests"; import { CacheTag } from "@/utils/cacheTag"; diff --git a/src/app/(main)/my-voyage/[teamId]/features/components/FeaturesComponentWrapper.tsx b/src/app/(main)/my-voyage/[teamId]/features/components/FeaturesComponentWrapper.tsx index 10a6212d..ca81309b 100644 --- a/src/app/(main)/my-voyage/[teamId]/features/components/FeaturesComponentWrapper.tsx +++ b/src/app/(main)/my-voyage/[teamId]/features/components/FeaturesComponentWrapper.tsx @@ -17,7 +17,7 @@ import { getAccessToken } from "@/utils/getCookie"; import { GET } from "@/utils/requests"; import { CacheTag } from "@/utils/cacheTag"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { ErrorType } from "@/utils/error"; function transformData(features: Features[]): FeaturesList[] { diff --git a/src/app/(main)/my-voyage/[teamId]/features/featuresService.ts b/src/app/(main)/my-voyage/[teamId]/features/featuresService.ts index 47361c62..3597c1b4 100644 --- a/src/app/(main)/my-voyage/[teamId]/features/featuresService.ts +++ b/src/app/(main)/my-voyage/[teamId]/features/featuresService.ts @@ -5,7 +5,7 @@ import { type Features } from "@/store/features/features/featuresSlice"; import { CacheTag } from "@/utils/cacheTag"; import { getAccessToken } from "@/utils/getCookie"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { DELETE, PATCH, POST } from "@/utils/requests"; interface SaveOrderProps { diff --git a/src/app/(main)/my-voyage/[teamId]/ideation/adapters/ideationSA.ts b/src/app/(main)/my-voyage/[teamId]/ideation/adapters/ideationSA.ts index 008f3e20..9ff0741f 100644 --- a/src/app/(main)/my-voyage/[teamId]/ideation/adapters/ideationSA.ts +++ b/src/app/(main)/my-voyage/[teamId]/ideation/adapters/ideationSA.ts @@ -5,7 +5,7 @@ import { IdeationClientAdapter } from "./ideationClientAdapter"; import { getAccessToken } from "@/utils/getCookie"; import { DELETE, PATCH, POST } from "@/utils/requests"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { CacheTag } from "@/utils/cacheTag"; import { type AddIdeationResponseDto } from "@/modules/ideation/application/dtos/response.dto"; import { type AddIdeationUsecaseDto } from "@/modules/ideation/application/dtos/addIdeationUsecaseDto"; diff --git a/src/app/(main)/my-voyage/[teamId]/ideation/components/IdeationComponentWrapper.tsx b/src/app/(main)/my-voyage/[teamId]/ideation/components/IdeationComponentWrapper.tsx index 413d1f77..277dd5b6 100644 --- a/src/app/(main)/my-voyage/[teamId]/ideation/components/IdeationComponentWrapper.tsx +++ b/src/app/(main)/my-voyage/[teamId]/ideation/components/IdeationComponentWrapper.tsx @@ -16,7 +16,7 @@ import { getAccessToken } from "@/utils/getCookie"; import { getCurrentVoyageData } from "@/utils/getCurrentVoyageData"; import { getUser } from "@/utils/getUser"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { GET } from "@/utils/requests"; import routePaths from "@/utils/routePaths"; import { ErrorType } from "@/utils/error"; diff --git a/src/app/(main)/my-voyage/[teamId]/sprints/components/RedirectToCurrentSprintWrapper.tsx b/src/app/(main)/my-voyage/[teamId]/sprints/components/RedirectToCurrentSprintWrapper.tsx index 7357515a..96a6acab 100644 --- a/src/app/(main)/my-voyage/[teamId]/sprints/components/RedirectToCurrentSprintWrapper.tsx +++ b/src/app/(main)/my-voyage/[teamId]/sprints/components/RedirectToCurrentSprintWrapper.tsx @@ -17,7 +17,7 @@ import { getCurrentSprint } from "@/utils/getCurrentSprint"; import { GET } from "@/utils/requests"; import { CacheTag } from "@/utils/cacheTag"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { type Sprint } from "@/store/features/sprint/sprintSlice"; import { getCurrentVoyageData } from "@/utils/getCurrentVoyageData"; import routePaths from "@/utils/routePaths"; diff --git a/src/app/(main)/my-voyage/[teamId]/sprints/components/SprintWrapper.tsx b/src/app/(main)/my-voyage/[teamId]/sprints/components/SprintWrapper.tsx index 6923111a..f22bfe47 100644 --- a/src/app/(main)/my-voyage/[teamId]/sprints/components/SprintWrapper.tsx +++ b/src/app/(main)/my-voyage/[teamId]/sprints/components/SprintWrapper.tsx @@ -26,7 +26,7 @@ import { import { getCurrentSprint } from "@/utils/getCurrentSprint"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { GET } from "@/utils/requests"; import { getAccessToken } from "@/utils/getCookie"; import { getUser } from "@/utils/getUser"; diff --git a/src/app/(main)/my-voyage/[teamId]/sprints/components/WeeklyCheckInWrapper.tsx b/src/app/(main)/my-voyage/[teamId]/sprints/components/WeeklyCheckInWrapper.tsx index 0367de0a..2e30a26f 100644 --- a/src/app/(main)/my-voyage/[teamId]/sprints/components/WeeklyCheckInWrapper.tsx +++ b/src/app/(main)/my-voyage/[teamId]/sprints/components/WeeklyCheckInWrapper.tsx @@ -10,7 +10,7 @@ import { getUser } from "@/utils/getUser"; import { GET } from "@/utils/requests"; import { CacheTag } from "@/utils/cacheTag"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { getCurrentVoyageData } from "@/utils/getCurrentVoyageData"; import routePaths from "@/utils/routePaths"; import { Forms } from "@/utils/form/formsEnums"; diff --git a/src/app/(main)/my-voyage/[teamId]/sprints/sprintsService.ts b/src/app/(main)/my-voyage/[teamId]/sprints/sprintsService.ts index 0d4b5a3a..275d8e9a 100644 --- a/src/app/(main)/my-voyage/[teamId]/sprints/sprintsService.ts +++ b/src/app/(main)/my-voyage/[teamId]/sprints/sprintsService.ts @@ -4,7 +4,7 @@ import { revalidateTag } from "next/cache"; import { getAccessToken } from "@/utils/getCookie"; import { DELETE, PATCH, POST } from "@/utils/requests"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { CacheTag } from "@/utils/cacheTag"; import { getSprintCache } from "@/utils/getSprintCache"; diff --git a/src/app/(main)/my-voyage/[teamId]/tech-stack/techStackService.ts b/src/app/(main)/my-voyage/[teamId]/tech-stack/techStackService.ts index 63d2924e..9f8963d4 100644 --- a/src/app/(main)/my-voyage/[teamId]/tech-stack/techStackService.ts +++ b/src/app/(main)/my-voyage/[teamId]/tech-stack/techStackService.ts @@ -5,7 +5,7 @@ import type { Category } from "./finalize/types"; import { CacheTag } from "@/utils/cacheTag"; import { getAccessToken } from "@/utils/getCookie"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { DELETE, PATCH, POST } from "@/utils/requests"; import { type TechStackItem } from "@/store/features/techStack/techStackSlice"; diff --git a/src/app/(main)/my-voyage/[teamId]/voyage-resources/resourcesService.ts b/src/app/(main)/my-voyage/[teamId]/voyage-resources/resourcesService.ts index 2bce5661..6b7aa428 100644 --- a/src/app/(main)/my-voyage/[teamId]/voyage-resources/resourcesService.ts +++ b/src/app/(main)/my-voyage/[teamId]/voyage-resources/resourcesService.ts @@ -4,7 +4,7 @@ import { revalidateTag } from "next/cache"; import { getAccessToken } from "@/utils/getCookie"; import { POST, DELETE } from "@/utils/requests"; import { handleAsync } from "@/utils/handleAsync"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { CacheTag } from "@/utils/cacheTag"; interface ResourceProps { diff --git a/src/hooks/useServerAction.ts b/src/hooks/useServerAction.ts index 71fd5ddb..0427b8c9 100644 --- a/src/hooks/useServerAction.ts +++ b/src/hooks/useServerAction.ts @@ -1,7 +1,7 @@ "use client"; import { useCallback, useState } from "react"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; type ActionType = (arg: X) => Promise>; diff --git a/src/modules/shared/types.ts b/src/modules/shared/types.ts deleted file mode 100644 index 58747625..00000000 --- a/src/modules/shared/types.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface AppError { - message: string; -} - -export type AsyncFunction = () => Promise; -export type AsyncActionResponse = [X | null, AppError | null]; diff --git a/src/store/features/modal/modalSlice.ts b/src/store/features/modal/modalSlice.ts index 65c4fbd8..282efcea 100644 --- a/src/store/features/modal/modalSlice.ts +++ b/src/store/features/modal/modalSlice.ts @@ -14,7 +14,7 @@ import { type DeleteFeatureProps, type deleteFeature, } from "@/myVoyage/features/featuresService"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { type DeleteAgendaTopicProps, type DeleteAgendaTopicResponse, diff --git a/src/types/types.ts b/src/types/types.ts index 077b0ae3..cf150593 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -1 +1,4 @@ // only put global types here +export interface AppError { + message: string; +} diff --git a/src/utils/getCurrentVoyageData.ts b/src/utils/getCurrentVoyageData.ts index 02de6ee3..c70a2a77 100644 --- a/src/utils/getCurrentVoyageData.ts +++ b/src/utils/getCurrentVoyageData.ts @@ -1,5 +1,6 @@ import { getCurrentVoyageTeam } from "./getCurrentVoyageTeam"; -import type { AsyncActionResponse, AppError } from "@/modules/shared/types"; +import { type AppError } from "@/types/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { type User } from "@/store/features/user/userSlice"; interface GetCurrentVoyageDataProps { diff --git a/src/utils/getCurrentVoyageTeam.ts b/src/utils/getCurrentVoyageTeam.ts index 466a6bd7..3f98c7ac 100644 --- a/src/utils/getCurrentVoyageTeam.ts +++ b/src/utils/getCurrentVoyageTeam.ts @@ -1,4 +1,4 @@ -import { type AppError } from "@/modules/shared/types"; +import { type AppError } from "@/types/types"; import { type User, type VoyageTeamMember, diff --git a/src/utils/getUser.ts b/src/utils/getUser.ts index 8865369b..84e5c7b7 100644 --- a/src/utils/getUser.ts +++ b/src/utils/getUser.ts @@ -1,7 +1,7 @@ import { getAccessToken } from "./getCookie"; import { handleAsync } from "./handleAsync"; import { GET } from "./requests"; -import { type AsyncActionResponse } from "@/modules/shared/types"; +import { type AsyncActionResponse } from "@/utils/handleAsync"; import { type User } from "@/store/features/user/userSlice"; export function getUser(): Promise> { diff --git a/src/utils/handleAsync.ts b/src/utils/handleAsync.ts index 3ca6f810..3bf8ffbd 100644 --- a/src/utils/handleAsync.ts +++ b/src/utils/handleAsync.ts @@ -1,7 +1,7 @@ -import { - type AsyncActionResponse, - type AsyncFunction, -} from "@/modules/shared/types"; +import { type AppError } from "@/types/types"; + +export type AsyncFunction = () => Promise; +export type AsyncActionResponse = [X | null, AppError | null]; export async function handleAsync( asyncFn: AsyncFunction,