Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
refactor(api:poll): use axios to fetch data
Browse files Browse the repository at this point in the history
  ## what
  - use `axios` to fetch data

  ## how

  ## why

  ## where
  - ./src/app/api/poll/[pollId]/route.ts

  ## usage
  • Loading branch information
Clumsy-Coder committed Dec 31, 2023
1 parent 5bb70f5 commit f3be800
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/api/poll/[pollId]/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NextResponse } from "next/server";
import { z } from "zod";
import axios from "axios";

import { Language, Problem, Submission, Verdict } from "@/types";
import { fetchLiveSubmissionsUrl, uhuntProblemIdUrl } from "@/utils/constants";
Expand Down Expand Up @@ -32,8 +33,8 @@ export const GET = async (_request: Request, { params }: getParamsType) => {

const url = fetchLiveSubmissionsUrl(+pollId);

const fetchResponse = await fetch(url);
const data: Submission[] = await fetchResponse.json();
const fetchResponse = await axios.get<Submission[]>(url)
const data = fetchResponse.data

const converted = data
.map(async (submission: Submission) => {
Expand Down

0 comments on commit f3be800

Please sign in to comment.