rename "get" util functions to "fetch"

This commit is contained in:
Nathaniel Tampus
2023-04-07 12:09:10 +08:00
parent 44af7ed0ae
commit a2bae7201d
6 changed files with 14 additions and 14 deletions

View File

@@ -22,7 +22,7 @@ export const createGame = async (side: string, unlisted: boolean) => {
}
};
export const getActiveGame = async (code: string) => {
export const fetchActiveGame = async (code: string) => {
try {
const res = await fetch(`${API_URL}/v1/games/${code}`, { cache: "no-store" });
@@ -35,7 +35,7 @@ export const getActiveGame = async (code: string) => {
}
};
export const getPublicGames = async () => {
export const fetchPublicGames = async () => {
try {
const res = await fetch(`${API_URL}/v1/games`, { cache: "no-store" });
@@ -48,7 +48,7 @@ export const getPublicGames = async () => {
}
};
export const getArchivedGame = async ({ id, userid }: { id?: number; userid?: number }) => {
export const fetchArchivedGame = async ({ id, userid }: { id?: number; userid?: number }) => {
let url = `${API_URL}/v1/games?`;
if (id) {
url += `id=${id}`;

View File

@@ -1,7 +1,7 @@
import { API_URL } from "@/config";
import type { User, Game } from "@chessu/types";
export const getProfileData = async (name: string) => {
export const fetchProfileData = async (name: string) => {
try {
// TODO: handle caching more efficiently?
const res = await fetch(`${API_URL}/v1/users/${name}`, {