Add refresh button to icon marketplace page
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { HomeButton } from '@/app/components/HomeButton'
|
|
||||||
import { DiscordButton } from '@/app/components/DiscordButton'
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { BackButton } from '@/app/components/BackButton'
|
import { BackButton } from '@/app/components/BackButton'
|
||||||
|
import { ReloadButton } from '@/app/components/ReloadButton'
|
||||||
|
|
||||||
interface MarketplaceIcon {
|
interface MarketplaceIcon {
|
||||||
username: string
|
username: string
|
||||||
@@ -20,22 +19,29 @@ interface MarketplaceIcon {
|
|||||||
export default function BerryDashIconMarketplace () {
|
export default function BerryDashIconMarketplace () {
|
||||||
const [response, setResponse] = useState<MarketplaceIcon[] | null | -1>(null)
|
const [response, setResponse] = useState<MarketplaceIcon[] | null | -1>(null)
|
||||||
|
|
||||||
useEffect(() => {
|
async function Refresh () {
|
||||||
document.title = 'Lncvrt Games - Berry Dash Icon Marketplace'
|
|
||||||
;(async () => {
|
|
||||||
try {
|
try {
|
||||||
const request = await axios.get('/api/berrydash/icon-marketplace')
|
const request = await axios.get('/api/berrydash/icon-marketplace')
|
||||||
setResponse(request.data.success ? request.data.data : -1)
|
setResponse(request.data.success ? request.data.data : -1)
|
||||||
} catch {
|
} catch {
|
||||||
setResponse(-1)
|
setResponse(-1)
|
||||||
}
|
}
|
||||||
})()
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
document.title = 'Lncvrt Games - Berry Dash Icon Marketplace'
|
||||||
|
Refresh()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='box text-center'>
|
<div className='box text-center'>
|
||||||
<BackButton href='/game/berry-dash' />
|
<BackButton href='/game/berry-dash' />
|
||||||
<DiscordButton />
|
<ReloadButton
|
||||||
|
action={() => {
|
||||||
|
setResponse(null)
|
||||||
|
Refresh()
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<p className='px-8 -mt-2 mb-4 text-2xl'>Berry Dash Icon Marketplace</p>
|
<p className='px-8 -mt-2 mb-4 text-2xl'>Berry Dash Icon Marketplace</p>
|
||||||
<p>A browser for the in game icon marketplace!</p>
|
<p>A browser for the in game icon marketplace!</p>
|
||||||
<div className='sub-box mt-2 -mx-4 -mb-4 flex flex-row flex-wrap justify-center gap-2 max-w-[95vw]'>
|
<div className='sub-box mt-2 -mx-4 -mb-4 flex flex-row flex-wrap justify-center gap-2 max-w-[95vw]'>
|
||||||
|
|||||||
Reference in New Issue
Block a user