Compare commits

..

No commits in common. "e6a38e2a0b178c31e48df1b96621da8d7a0d7b69" and "b8f271fdb20cd005b330c0679baa671daa65903d" have entirely different histories.

2 changed files with 4 additions and 11 deletions

View File

@ -2,6 +2,7 @@ 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 {
@ -20,8 +21,7 @@ function toPlayer(apiPlayer: APIPlayer): Player {
function toRoom(apiRoom: APIRoom): Room { function toRoom(apiRoom: APIRoom): Room {
return { return {
id: apiRoom.id, id: apiRoom.roomId,
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 fetchRooms() { export async function fetchData() {
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,8 +55,3 @@ export async function fetchRooms() {
.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()
// }

View File

@ -56,8 +56,7 @@ export interface APIPlayer {
} }
export interface Room { export interface Room {
id: string; id: number;
roomId: number;
createdAt: Date; createdAt: Date;
gameVersion: string; gameVersion: string;
roomBattleRank: number; roomBattleRank: number;
@ -67,7 +66,6 @@ export interface Room {
} }
export interface APIRoom { export interface APIRoom {
id: string;
userId: string; userId: string;
roomId: number; roomId: number;
dataVersion: string; dataVersion: string;