khagu commited on
Commit
f65bb7f
·
1 Parent(s): 9adf4ea

fix: standardize routing and remove trailing slashes for better compatibility

Browse files
Frontend/lib/api.ts CHANGED
@@ -24,38 +24,44 @@ export async function fetchWithAuth(endpoint: string, options: RequestInit = {})
24
 
25
  export const api = {
26
  projects: {
27
- list: () => fetchWithAuth('/v1/projects/'),
28
- create: (data: any) => fetchWithAuth('/v1/projects/', { method: 'POST', body: JSON.stringify(data) }),
29
  update: (id: string, data: any) => fetchWithAuth(`/v1/projects/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
30
  delete: (id: string) => fetchWithAuth(`/v1/projects/${id}`, { method: 'DELETE' }),
31
  },
32
  research: {
33
- list: () => fetchWithAuth('/v1/research/'),
34
- create: (data: any) => fetchWithAuth('/v1/research/', { method: 'POST', body: JSON.stringify(data) }),
35
  update: (id: string, data: any) => fetchWithAuth(`/v1/research/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
36
  delete: (id: string) => fetchWithAuth(`/v1/research/${id}`, { method: 'DELETE' }),
37
  },
38
  events: {
39
- list: () => fetchWithAuth('/v1/events/'),
40
- create: (data: any) => fetchWithAuth('/v1/events/', { method: 'POST', body: JSON.stringify(data) }),
41
  update: (id: string, data: any) => fetchWithAuth(`/v1/events/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
42
  delete: (id: string) => fetchWithAuth(`/v1/events/${id}`, { method: 'DELETE' }),
43
  },
44
  edu: {
45
- list: () => fetchWithAuth('/v1/edu/'),
46
- create: (data: any) => fetchWithAuth('/v1/edu/', { method: 'POST', body: JSON.stringify(data) }),
47
  update: (id: string, data: any) => fetchWithAuth(`/v1/edu/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
48
  delete: (id: string) => fetchWithAuth(`/v1/edu/${id}`, { method: 'DELETE' }),
49
  },
 
 
 
 
 
 
50
  teams: {
51
- list: () => fetchWithAuth('/v1/teams/'),
52
- create: (data: any) => fetchWithAuth('/v1/teams/', { method: 'POST', body: JSON.stringify(data) }),
53
  update: (id: string, data: any) => fetchWithAuth(`/v1/teams/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
54
  delete: (id: string) => fetchWithAuth(`/v1/teams/${id}`, { method: 'DELETE' }),
55
  },
56
  reviews: {
57
- list: () => fetchWithAuth('/v1/reviews/'),
58
- create: (data: any) => fetchWithAuth('/v1/reviews/', { method: 'POST', body: JSON.stringify(data) }),
59
  update: (id: string, data: any) => fetchWithAuth(`/v1/reviews/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
60
  delete: (id: string) => fetchWithAuth(`/v1/reviews/${id}`, { method: 'DELETE' }),
61
  },
 
24
 
25
  export const api = {
26
  projects: {
27
+ list: () => fetchWithAuth('/v1/projects'),
28
+ create: (data: any) => fetchWithAuth('/v1/projects', { method: 'POST', body: JSON.stringify(data) }),
29
  update: (id: string, data: any) => fetchWithAuth(`/v1/projects/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
30
  delete: (id: string) => fetchWithAuth(`/v1/projects/${id}`, { method: 'DELETE' }),
31
  },
32
  research: {
33
+ list: () => fetchWithAuth('/v1/research'),
34
+ create: (data: any) => fetchWithAuth('/v1/research', { method: 'POST', body: JSON.stringify(data) }),
35
  update: (id: string, data: any) => fetchWithAuth(`/v1/research/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
36
  delete: (id: string) => fetchWithAuth(`/v1/research/${id}`, { method: 'DELETE' }),
37
  },
38
  events: {
39
+ list: () => fetchWithAuth('/v1/events'),
40
+ create: (data: any) => fetchWithAuth('/v1/events', { method: 'POST', body: JSON.stringify(data) }),
41
  update: (id: string, data: any) => fetchWithAuth(`/v1/events/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
42
  delete: (id: string) => fetchWithAuth(`/v1/events/${id}`, { method: 'DELETE' }),
43
  },
44
  edu: {
45
+ list: () => fetchWithAuth('/v1/edu'),
46
+ create: (data: any) => fetchWithAuth('/v1/edu', { method: 'POST', body: JSON.stringify(data) }),
47
  update: (id: string, data: any) => fetchWithAuth(`/v1/edu/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
48
  delete: (id: string) => fetchWithAuth(`/v1/edu/${id}`, { method: 'DELETE' }),
49
  },
50
+ blogs: {
51
+ list: () => fetchWithAuth('/v1/blogs'),
52
+ create: (data: any) => fetchWithAuth('/v1/blogs', { method: 'POST', body: JSON.stringify(data) }),
53
+ update: (id: string, data: any) => fetchWithAuth(`/v1/blogs/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
54
+ delete: (id: string) => fetchWithAuth(`/v1/blogs/${id}`, { method: 'DELETE' }),
55
+ },
56
  teams: {
57
+ list: () => fetchWithAuth('/v1/teams'),
58
+ create: (data: any) => fetchWithAuth('/v1/teams', { method: 'POST', body: JSON.stringify(data) }),
59
  update: (id: string, data: any) => fetchWithAuth(`/v1/teams/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
60
  delete: (id: string) => fetchWithAuth(`/v1/teams/${id}`, { method: 'DELETE' }),
61
  },
62
  reviews: {
63
+ list: () => fetchWithAuth('/v1/reviews'),
64
+ create: (data: any) => fetchWithAuth('/v1/reviews', { method: 'POST', body: JSON.stringify(data) }),
65
  update: (id: string, data: any) => fetchWithAuth(`/v1/reviews/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
66
  delete: (id: string) => fetchWithAuth(`/v1/reviews/${id}`, { method: 'DELETE' }),
67
  },
app/api/v1/blogs.py CHANGED
@@ -5,7 +5,7 @@ from app.dependencies.admin_auth import admin_auth
5
 
6
  router = APIRouter()
7
 
8
- @router.get("/", response_model=list[Blog])
9
  def list_blogs():
10
  res = supabase.table("blogs").select("*").order("published_date", desc=True).execute()
11
  return res.data
 
5
 
6
  router = APIRouter()
7
 
8
+ @router.get("", response_model=list[Blog])
9
  def list_blogs():
10
  res = supabase.table("blogs").select("*").order("published_date", desc=True).execute()
11
  return res.data
app/api/v1/edu.py CHANGED
@@ -5,7 +5,7 @@ from app.dependencies.admin_auth import admin_auth
5
 
6
  router = APIRouter()
7
 
8
- @router.get("/", response_model=list[EduContent])
9
  def list_edu_contents():
10
  res = supabase.table("educational_contents").select("*").order("created_at", desc=True).execute()
11
  return res.data
 
5
 
6
  router = APIRouter()
7
 
8
+ @router.get("", response_model=list[EduContent])
9
  def list_edu_contents():
10
  res = supabase.table("educational_contents").select("*").order("created_at", desc=True).execute()
11
  return res.data
app/api/v1/events.py CHANGED
@@ -5,7 +5,7 @@ from app.dependencies.admin_auth import admin_auth
5
 
6
  router = APIRouter()
7
 
8
- @router.get("/", response_model=list[Event])
9
  def list_events():
10
  res = supabase.table("events").select("*").order("date", desc=True).execute()
11
  return res.data
 
5
 
6
  router = APIRouter()
7
 
8
+ @router.get("", response_model=list[Event])
9
  def list_events():
10
  res = supabase.table("events").select("*").order("date", desc=True).execute()
11
  return res.data
app/api/v1/projects.py CHANGED
@@ -5,7 +5,7 @@ from app.dependencies.admin_auth import admin_auth
5
 
6
  router = APIRouter()
7
 
8
- @router.get("/", response_model=list[Project])
9
  def list_projects():
10
  res = supabase.table("projects").select("*").order("created_at", desc=True).execute()
11
  return res.data
 
5
 
6
  router = APIRouter()
7
 
8
+ @router.get("", response_model=list[Project])
9
  def list_projects():
10
  res = supabase.table("projects").select("*").order("created_at", desc=True).execute()
11
  return res.data
app/api/v1/research.py CHANGED
@@ -5,7 +5,7 @@ from app.dependencies.admin_auth import admin_auth
5
 
6
  router = APIRouter()
7
 
8
- @router.get("/", response_model=list[Research])
9
  def list_research():
10
  res = supabase.table("research").select("*").order("published_date", desc=True).execute()
11
  return res.data
 
5
 
6
  router = APIRouter()
7
 
8
+ @router.get("", response_model=list[Research])
9
  def list_research():
10
  res = supabase.table("research").select("*").order("published_date", desc=True).execute()
11
  return res.data
app/api/v1/reviews.py CHANGED
@@ -7,7 +7,7 @@ from app.dependencies.admin_auth import admin_auth
7
 
8
  router = APIRouter()
9
 
10
- @router.get("/", response_model=list[Review])
11
  def list_reviews():
12
  res = supabase.table("reviews").select("*").order("created_at", desc=True).execute()
13
  return res.data
 
7
 
8
  router = APIRouter()
9
 
10
+ @router.get("", response_model=list[Review])
11
  def list_reviews():
12
  res = supabase.table("reviews").select("*").order("created_at", desc=True).execute()
13
  return res.data
app/api/v1/teams.py CHANGED
@@ -5,7 +5,7 @@ from app.dependencies.admin_auth import admin_auth
5
 
6
  router = APIRouter()
7
 
8
- @router.get("/", response_model=list[Team])
9
  def list_teams():
10
  res = supabase.table("teams").select("*").order("id", desc=False).execute()
11
  return res.data
 
5
 
6
  router = APIRouter()
7
 
8
+ @router.get("", response_model=list[Team])
9
  def list_teams():
10
  res = supabase.table("teams").select("*").order("id", desc=False).execute()
11
  return res.data