other: rename file
This commit is contained in:
parent
26d216d4cb
commit
e6a38e2a0b
@ -2,7 +2,6 @@ import { env } from '$env/dynamic/private';
|
||||
import type { APIPlayer, APIRoom, Player, Room } from '$lib/types';
|
||||
import { fromVersionString, greaterThan } from '$lib/versioning';
|
||||
import axios from 'axios';
|
||||
import type { FetchFunction } from 'vite';
|
||||
|
||||
function toPlayer(apiPlayer: APIPlayer): Player {
|
||||
return {
|
||||
@ -21,7 +20,8 @@ function toPlayer(apiPlayer: APIPlayer): Player {
|
||||
|
||||
function toRoom(apiRoom: APIRoom): Room {
|
||||
return {
|
||||
id: apiRoom.roomId,
|
||||
id: apiRoom.id,
|
||||
roomId: apiRoom.roomId,
|
||||
createdAt: new Date(apiRoom.updatedAt),
|
||||
gameVersion: apiRoom.dataVersion,
|
||||
roomBattleRank: apiRoom.roomRanking,
|
||||
@ -37,7 +37,7 @@ function filterRooms(rooms: Room[]): Room[] {
|
||||
);
|
||||
}
|
||||
|
||||
export async function fetchData() {
|
||||
export async function fetchRooms() {
|
||||
return {
|
||||
activeRooms: await axios
|
||||
.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))))
|
||||
};
|
||||
}
|
||||
|
||||
// TODO!
|
||||
// export async function fetchRoom(roomId: string): Promise<Room> {
|
||||
// return new Promise()
|
||||
// }
|
Loading…
Reference in New Issue
Block a user