Skip to content

Commit d01126b

Browse files
committed
api 상수 변경
1 parent 27a22ed commit d01126b

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/app/api/todos.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { TENANT_ID } from "../constants/todo";
12
import { Todo } from "../types/todo";
23
import { PatchItemPayload } from "./types";
34

45
export const getTodos = async (): Promise<Todo[]> => {
56
const res = await fetch(
6-
"https://assignment-todolist-api.vercel.app/api/jinsun/items?page=1&pageSize=30"
7+
`https://assignment-todolist-api.vercel.app/api/${TENANT_ID}/items?page=1&pageSize=30`
78
);
89
const json = await res.json();
910
return json ?? [];
@@ -14,7 +15,7 @@ export const patchItem = async (
1415
data: PatchItemPayload
1516
): Promise<void> => {
1617
const res = await fetch(
17-
`https://assignment-todolist-api.vercel.app/api/jinsun/items/${itemId}`,
18+
`https://assignment-todolist-api.vercel.app/api/${TENANT_ID}/items/${itemId}`,
1819
{
1920
method: "PATCH",
2021
headers: {
@@ -32,7 +33,7 @@ export const patchItem = async (
3233

3334
export const addTodo = async (name: string): Promise<void> => {
3435
const res = await fetch(
35-
"https://assignment-todolist-api.vercel.app/api/jinsun/items",
36+
`https://assignment-todolist-api.vercel.app/api/${TENANT_ID}/items`,
3637
{
3738
method: "POST",
3839
body: JSON.stringify({ name }),

src/app/constants/todo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const TENANT_ID = "jinsunkimdev"

0 commit comments

Comments
 (0)