switched theme
This commit is contained in:
40
lib/profile.ts
Normal file
40
lib/profile.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { getCookie } from "./roblox"
|
||||
|
||||
export type UserProfileDetails = {
|
||||
description: string,
|
||||
created: Date,
|
||||
isBanned: boolean,
|
||||
externalAppDisplayName: string,
|
||||
hasVerifiedBadge: boolean,
|
||||
id: number,
|
||||
name: string,
|
||||
displayName: string
|
||||
}
|
||||
|
||||
export async function getLoggedInUser(): Promise<{
|
||||
id: number,
|
||||
name: string,
|
||||
displayName: string
|
||||
}> {
|
||||
const data = await fetch(`${document.baseURI}api/user/authenticated`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `${getCookie()}`
|
||||
},
|
||||
})
|
||||
return (await data.json() as any) as {
|
||||
id: number,
|
||||
name: string,
|
||||
displayName: string
|
||||
}
|
||||
}
|
||||
|
||||
export async function getUserByUserId(userid: string): Promise<UserProfileDetails> {
|
||||
const data = await fetch(`${document.baseURI}api/user?id=${userid}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `${getCookie()}`
|
||||
},
|
||||
})
|
||||
return (await data.json() as any) as UserProfileDetails
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { addGameThumbnail } from "@/hooks/use-lazy-load";
|
||||
import { addThumbnail } from "@/hooks/use-lazy-load";
|
||||
import { getCookie } from "./roblox";
|
||||
|
||||
export type AssetThumbnail = {
|
||||
@@ -45,7 +45,9 @@ export async function getThumbnails(b: ThumbnailRequest[]): Promise<AssetThumbna
|
||||
export async function loadThumbnails(b: ThumbnailRequest[]): Promise<void> {
|
||||
const th = await getThumbnails(b);
|
||||
th.forEach(a=>{
|
||||
addGameThumbnail(a.targetId.toString(), a.imageUrl)
|
||||
// match GameThumbnail from 4972273297::GameThumbnail:384x216:webp:regular and any like- string
|
||||
const ty = b.find(c=>c.targetId==a.targetId)!
|
||||
addThumbnail(ty.type+'_'+a.targetId.toString(), a.imageUrl)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user