mirror of
https://github.com/gabehf/Prittee.git
synced 2026-03-07 21:48:14 -08:00
Merge branch 'gabehf:main' into main
This commit is contained in:
commit
994e60fb00
5 changed files with 52 additions and 2 deletions
13
README.md
13
README.md
|
|
@ -4,4 +4,15 @@ Prittee is an unofficial, experimental alternate front end for Pithee, the site
|
|||
|
||||
Prittee has some limitations due to it being an unofficial site, such as the fact that you can only be logged in for an hour at a time, so I don't expect this to replace the official Pithee site for people's pith-ing needs. This was mostly made as an exercise for me.
|
||||
|
||||
The site is made in React, using React Router v6.
|
||||
The site is made in React, using React Router v6.
|
||||
|
||||
## Albums that fueled development
|
||||
|
||||
| Album | Artist |
|
||||
|----------------------------------------------------|---------------------|
|
||||
| I Brought You My Bullets, You Brought Me Your Love | My Chemical Romance |
|
||||
| Brother, Sister | mewithoutYou |
|
||||
| Clockwork Angels | Rush |
|
||||
| DROP | Minami |
|
||||
| Super Enthusiast | Macseal |
|
||||
| Lake | LAKE |
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"@testing-library/react": "^13.0.0",
|
||||
"@testing-library/user-event": "^13.2.1",
|
||||
"@vercel/analytics": "^1.2.2",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.22.3",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { Box, Container } from '@mui/material';
|
|||
import { Outlet } from 'react-router-dom';
|
||||
import Header from './Components/Header';
|
||||
import Footer from './Components/Footer';
|
||||
import { Analytics } from "@vercel/analytics/react"
|
||||
|
||||
// TODO:
|
||||
// - Leaderboard past #25 (pagination)
|
||||
|
|
@ -22,6 +23,7 @@ function App() {
|
|||
<Outlet />
|
||||
</Box>
|
||||
<Footer/>
|
||||
<Analytics />
|
||||
</Box>
|
||||
</Container>
|
||||
);
|
||||
|
|
|
|||
26
src/utils.js
26
src/utils.js
|
|
@ -60,7 +60,31 @@ const loadUser = async function() {
|
|||
}
|
||||
|
||||
const loadUserPosts = async function () {
|
||||
return makePitheeApiCall(playerPostsUrl, 'POST', null) // why POST?
|
||||
return new Promise((resolve) => {
|
||||
fetch(playerPostsUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"apikey": localStorage.getItem('apikey'),
|
||||
"authorization": localStorage.getItem('token'),
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: null
|
||||
})
|
||||
.then(r => r.json().then(data => ({status: r.status, body: data})))
|
||||
.then((r) => {
|
||||
if (r.status >= 200 && r.status <= 299) { // OK range
|
||||
|
||||
// usually we check if the r.body return array length is 0, but that
|
||||
// fails on this call because the user may not have any posts, so
|
||||
// just resolve
|
||||
|
||||
resolve(r.body)
|
||||
} else {
|
||||
alert("Your token has expired. Please re-enter your information to keep using Prittee.")
|
||||
window.location.href = '/login'
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const loadCurrentWinner = async function() {
|
||||
|
|
|
|||
12
yarn.lock
12
yarn.lock
|
|
@ -2597,6 +2597,13 @@
|
|||
resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406"
|
||||
integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==
|
||||
|
||||
"@vercel/analytics@^1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@vercel/analytics/-/analytics-1.2.2.tgz#715d8f203a170c06ba36b363e03b048c03060d5d"
|
||||
integrity sha512-X0rctVWkQV1e5Y300ehVNqpOfSOufo7ieA5PIdna8yX/U7Vjz0GFsGf4qvAhxV02uQ2CVt7GYcrFfddXXK2Y4A==
|
||||
dependencies:
|
||||
server-only "^0.0.1"
|
||||
|
||||
"@webassemblyjs/ast@1.12.1", "@webassemblyjs/ast@^1.12.1":
|
||||
version "1.12.1"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.12.1.tgz#bb16a0e8b1914f979f45864c23819cc3e3f0d4bb"
|
||||
|
|
@ -8745,6 +8752,11 @@ serve-static@1.15.0:
|
|||
parseurl "~1.3.3"
|
||||
send "0.18.0"
|
||||
|
||||
server-only@^0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/server-only/-/server-only-0.0.1.tgz#0f366bb6afb618c37c9255a314535dc412cd1c9e"
|
||||
integrity sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA==
|
||||
|
||||
set-function-length@^1.2.1:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue