-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* upgrade to next 15 and react 19 * disable oauth-app * upgrade @radix-ui/react-slider to the latest version * upgrade all radix packages
- Loading branch information
1 parent
0d3c337
commit d9d01f8
Showing
20 changed files
with
1,190 additions
and
885 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,61 @@ | ||
'use client' | ||
|
||
import { Silkscreen } from 'next/font/google' | ||
import { useSearchParams } from 'next/navigation' | ||
import { Suspense, useEffect, useState } from 'react' | ||
|
||
const silkscreen = Silkscreen({ weight: '400', subsets: ['latin'] }) | ||
|
||
export default async function Page({ | ||
searchParams, | ||
}: { | ||
searchParams: { [key: string]: string | string[] | undefined } | ||
}) { | ||
const code = searchParams.code | ||
function Code() { | ||
const [json, setJson] = useState() | ||
const searchParams = useSearchParams() | ||
const code = searchParams.get('code') | ||
console.log({ code }) | ||
const formData = new URLSearchParams({ | ||
grant_type: 'authorization_code', | ||
code, | ||
redirect_uri: 'http://localhost:3000', | ||
} as Record<string, string>) | ||
const response = await fetch('http://localhost:3006/token', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Accept: 'application/json', | ||
}, | ||
body: formData.toString(), | ||
}) | ||
const json = await response.json() | ||
console.log({ json }) | ||
// // console.log(headers()) | ||
// // console.log(userAgent({ headers: headers() as Headers })) | ||
// const authCode = crypto.randomBytes(16).toString('hex') | ||
// const authCodes = getCache<{ [key: string]: boolean }>('authCodes') || {} | ||
// authCodes[authCode] = true | ||
// setCache('authCodes', authCodes, 120) | ||
|
||
useEffect(() => { | ||
async function createTokens() { | ||
const formData = new URLSearchParams({ | ||
grant_type: 'authorization_code', | ||
code, | ||
redirect_uri: 'http://localhost:3000', | ||
} as Record<string, string>) | ||
const response = await fetch('http://localhost:3006/token', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Accept: 'application/json', | ||
}, | ||
body: formData.toString(), | ||
}) | ||
const json = await response.json() | ||
console.log({ json }) | ||
setJson(json) | ||
// // console.log(headers()) | ||
// // console.log(userAgent({ headers: headers() as Headers })) | ||
// const authCode = crypto.randomBytes(16).toString('hex') | ||
// const authCodes = getCache<{ [key: string]: boolean }>('authCodes') || {} | ||
// authCodes[authCode] = true | ||
// setCache('authCodes', authCodes, 120) | ||
} | ||
createTokens() | ||
}, [code]) | ||
|
||
return ( | ||
<> | ||
<div>{code}</div> | ||
{json && <code>{JSON.stringify(json)}</code>} | ||
</> | ||
) | ||
} | ||
|
||
export default function Page() { | ||
return ( | ||
<main | ||
className={`${silkscreen.className} flex min-h-screen flex-col items-center justify-between p-24`} | ||
> | ||
<div>{code}</div> | ||
<code>{JSON.stringify(json)}</code> | ||
<Suspense> | ||
<Code /> | ||
</Suspense> | ||
</main> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.