other: rename file

This commit is contained in:
metamethods 2024-12-31 21:36:08 -08:00
parent 26d216d4cb
commit e6a38e2a0b

View File

@ -2,7 +2,6 @@ import { env } from '$env/dynamic/private';
import type { APIPlayer, APIRoom, Player, Room } from '$lib/types'; import type { APIPlayer, APIRoom, Player, Room } from '$lib/types';
import { fromVersionString, greaterThan } from '$lib/versioning'; import { fromVersionString, greaterThan } from '$lib/versioning';
import axios from 'axios'; import axios from 'axios';
import type { FetchFunction } from 'vite';
function toPlayer(apiPlayer: APIPlayer): Player { function toPlayer(apiPlayer: APIPlayer): Player {
return { return {
@ -21,7 +20,8 @@ function toPlayer(apiPlayer: APIPlayer): Player {
function toRoom(apiRoom: APIRoom): Room { function toRoom(apiRoom: APIRoom): Room {
return { return {
id: apiRoom.roomId, id: apiRoom.id,
roomId: apiRoom.roomId,
createdAt: new Date(apiRoom.updatedAt), createdAt: new Date(apiRoom.updatedAt),
gameVersion: apiRoom.dataVersion, gameVersion: apiRoom.dataVersion,
roomBattleRank: apiRoom.roomRanking, roomBattleRank: apiRoom.roomRanking,
@ -37,7 +37,7 @@ function filterRooms(rooms: Room[]): Room[] {
); );
} }
export async function fetchData() { export async function fetchRooms() {
return { return {
activeRooms: await axios activeRooms: await axios
.get<APIRoom[]>('http://yukiotoko.chara.lol:9000/api/active', { .get<APIRoom[]>('http://yukiotoko.chara.lol:9000/api/active', {
@ -55,3 +55,8 @@ export async function fetchData() {
.then((result) => filterRooms(result.data.map((apiRoom) => toRoom(apiRoom)))) .then((result) => filterRooms(result.data.map((apiRoom) => toRoom(apiRoom))))
}; };
} }
// TODO!
// export async function fetchRoom(roomId: string): Promise<Room> {
// return new Promise()
// }