Skip to content

Commit

Permalink
fix channel get
Browse files Browse the repository at this point in the history
  • Loading branch information
Zibbp committed Dec 13, 2024
1 parent f75d1d7 commit 1659d3e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions frontend/app/hooks/useChannels.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import useAxios from "./useAxios";
import useAxios, { ApiResponse } from "./useAxios";
import { AxiosInstance } from "axios";

export interface Channel {
Expand All @@ -15,13 +15,17 @@ export interface Channel {
}

const fetchChannels = async (): Promise<Array<Channel>> => {
const response = await useAxios.get<Array<Channel>>("/api/v1/channel");
return response.data;
const response = await useAxios.get<ApiResponse<Array<Channel>>>(
"/api/v1/channel"
);
return response.data.data;
};

const fetchChannelByName = async (name: string): Promise<Channel> => {
const response = await useAxios.get<Channel>(`/api/v1/channel/name/${name}`);
return response.data;
const response = await useAxios.get<ApiResponse<Channel>>(
`/api/v1/channel/name/${name}`
);
return response.data.data;
};

const useFetchChannels = () => {
Expand Down

0 comments on commit 1659d3e

Please sign in to comment.