Skip to content

Commit d2ae6d5

Browse files
committed
Move types to api folder
1 parent 550b54c commit d2ae6d5

File tree

13 files changed

+15
-13
lines changed

13 files changed

+15
-13
lines changed

api/issues.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { axios } from "./axios";
2+
import type { Issue } from "./issues.types";
3+
import type { Page } from "@typings/page.types";
24

35
type IssueFilters = {
46
status?: "open" | "resolved";
@@ -11,7 +13,7 @@ export async function getIssues(
1113
filters: IssueFilters = {},
1214
options?: { signal?: AbortSignal }
1315
) {
14-
const { data } = await axios.get(ENDPOINT, {
16+
const { data } = await axios.get<Page<Issue>>(ENDPOINT, {
1517
params: { page, ...filters },
1618
signal: options?.signal,
1719
});
File renamed without changes.

api/projects.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { axios } from "./axios";
2+
import type { Project } from "./projects.types";
23

34
const ENDPOINT = "/project";
45

56
export async function getProjects() {
6-
const { data } = await axios.get(ENDPOINT);
7+
const { data } = await axios.get<Project[]>(ENDPOINT);
78
return data;
89
}
File renamed without changes.

features/issues/api/use-get-issues.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useEffect } from "react";
22
import { useQuery, useQueryClient } from "@tanstack/react-query";
33
import { getIssues } from "@api/issues";
44
import type { Page } from "@typings/page.types";
5-
import type { Issue } from "../types";
5+
import type { Issue } from "@api/issues.types";
66

77
const QUERY_KEY = "issues";
88

features/issues/api/use-resolve-issue.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
22
import { useRef } from "react";
33
import { resolveIssue } from "@api/issues";
44
import * as GetIssues from "./use-get-issues";
5-
import type { Issue } from "../types";
5+
import type { Issue } from "@api/issues.types";
66

77
export function useResolveIssue(page: number) {
88
const queryClient = useQueryClient();

features/issues/components/issue-list/issue-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState } from "react";
22
import styled from "styled-components";
3-
import { ProjectLanguage } from "@features/projects";
3+
import { ProjectLanguage } from "@api/projects.types";
44
import { color, space, textFont } from "@styles/theme";
55
import { IssueRow } from "./issue-row";
66
import { useGetIssues, useResolveIssue } from "../../api";

features/issues/components/issue-list/issue-row.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import styled from "styled-components";
22
import capitalize from "lodash/capitalize";
33
import { color, space, textFont } from "@styles/theme";
44
import { Badge, BadgeColor, BadgeSize } from "@features/ui";
5-
import { ProjectLanguage } from "@features/projects";
6-
import { IssueLevel } from "../../types";
7-
import type { Issue } from "../../types";
5+
import { ProjectLanguage } from "@api/projects.types";
6+
import { IssueLevel } from "@api/issues.types";
7+
import type { Issue } from "@api/issues.types";
88

99
type IssueRowProps = {
1010
projectLanguage: ProjectLanguage;

features/issues/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
export * from "./api";
22
export * from "./components/issue-list";
3-
export * from "./types";

features/projects/api/use-projects.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useQuery } from "@tanstack/react-query";
22
import { getProjects } from "@api/projects";
3-
import type { Project } from "../types";
3+
import type { Project } from "@api/projects.types";
44

55
export function useProjects() {
66
return useQuery<Project[], Error>(["projects"], getProjects);

0 commit comments

Comments
 (0)