Compare commits
No commits in common. "e6a38e2a0b178c31e48df1b96621da8d7a0d7b69" and "b8f271fdb20cd005b330c0679baa671daa65903d" have entirely different histories.
e6a38e2a0b
...
b8f271fdb2
@ -2,6 +2,7 @@ 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 {
|
||||
@ -20,8 +21,7 @@ function toPlayer(apiPlayer: APIPlayer): Player {
|
||||
|
||||
function toRoom(apiRoom: APIRoom): Room {
|
||||
return {
|
||||
id: apiRoom.id,
|
||||
roomId: apiRoom.roomId,
|
||||
id: 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 fetchRooms() {
|
||||
export async function fetchData() {
|
||||
return {
|
||||
activeRooms: await axios
|
||||
.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))))
|
||||
};
|
||||
}
|
||||
|
||||
// TODO!
|
||||
// export async function fetchRoom(roomId: string): Promise<Room> {
|
||||
// return new Promise()
|
||||
// }
|
@ -56,8 +56,7 @@ export interface APIPlayer {
|
||||
}
|
||||
|
||||
export interface Room {
|
||||
id: string;
|
||||
roomId: number;
|
||||
id: number;
|
||||
createdAt: Date;
|
||||
gameVersion: string;
|
||||
roomBattleRank: number;
|
||||
@ -67,7 +66,6 @@ export interface Room {
|
||||
}
|
||||
|
||||
export interface APIRoom {
|
||||
id: string;
|
||||
userId: string;
|
||||
roomId: number;
|
||||
dataVersion: string;
|
||||
|
Loading…
Reference in New Issue
Block a user