Skip to content

Commit 3a60506

Browse files
committed
feat: refactor auth config to typescript
1 parent 133467a commit 3a60506

9 files changed

Lines changed: 121 additions & 87 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#OctoPlay - A Simplified Music Analytics Tool
22

3-
OctoPlay is an easy-to-use music app to analyse and gain insightful data on your music experience.
4-
Currently supporting Spotify using their [Web API](https://developer.spotify.com/documentation/web-api/).
3+
OctoPlay is an easy-to-use music app to analyse and gain insightful data on your
4+
music experience. Currently supporting Spotify using their
5+
[Web API](https://developer.spotify.com/documentation/web-api/).
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import NextAuth from "next-auth";
2+
import SpotifyProvider from "next-auth/providers/spotify";
3+
4+
const handler = NextAuth({
5+
providers: [
6+
SpotifyProvider({
7+
clientId: process.env.SPOTIFY_CLIENT_ID || "",
8+
clientSecret: process.env.SPOTIFY_CLIENT_SECRET || "",
9+
}),
10+
],
11+
});
12+
13+
export { handler as GET, handler as POST };

app/layout.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Metadata } from "next";
2+
import React from "react";
3+
import { SessionProvider } from "next-auth/react";
4+
import { SessionProviders } from "../utils/session-provider";
5+
6+
export const metadata: Metadata = {
7+
title: "OctoPlay",
8+
description: "Welcome to OctoPlay",
9+
};
10+
11+
export default function RootLayout({
12+
children,
13+
}: {
14+
children: React.ReactNode;
15+
}) {
16+
return (
17+
<html lang="en">
18+
<body>
19+
<SessionProviders>{children}</SessionProviders>
20+
</body>
21+
</html>
22+
);
23+
}

next-env.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
/// <reference types="next/navigation-types/compat/navigation" />
4+
5+
// NOTE: This file should not be edited
6+
// see https://nextjs.org/docs/basic-features/typescript for more information.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,10 @@
3131
"slick-carousel": "^1.8.1",
3232
"styled-components": "^6.0.7",
3333
"swr": "^2.2.2"
34+
},
35+
"devDependencies": {
36+
"@types/node": "20.6.0",
37+
"@types/react": "18.2.21",
38+
"typescript": "5.2.2"
3439
}
3540
}

pages/api/auth/[...nextauth].js

Lines changed: 0 additions & 85 deletions
This file was deleted.

tsconfig.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"compilerOptions": {
3+
"lib": [
4+
"dom",
5+
"dom.iterable",
6+
"esnext"
7+
],
8+
"allowJs": true,
9+
"skipLibCheck": true,
10+
"strict": false,
11+
"noEmit": true,
12+
"incremental": true,
13+
"esModuleInterop": true,
14+
"module": "esnext",
15+
"moduleResolution": "node",
16+
"resolveJsonModule": true,
17+
"isolatedModules": true,
18+
"jsx": "preserve",
19+
"plugins": [
20+
{
21+
"name": "next"
22+
}
23+
],
24+
"strictNullChecks": true
25+
},
26+
"include": [
27+
"next-env.d.ts",
28+
".next/types/**/*.ts",
29+
"**/*.ts",
30+
"**/*.tsx"
31+
],
32+
"exclude": [
33+
"node_modules"
34+
]
35+
}

utils/session-provider.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use client";
2+
3+
import { SessionProvider } from "next-auth/react";
4+
5+
export function SessionProviders({ children }) {
6+
return <SessionProvider>{children}</SessionProvider>;
7+
}

yarn.lock

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,11 +2155,35 @@
21552155
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.198.tgz#4d27465257011aedc741a809f1269941fa2c5d4c"
21562156
integrity sha512-trNJ/vtMZYMLhfN45uLq4ShQSw0/S7xCTLLVM+WM1rmFpba/VS42jVUgaO3w/NOLiWR/09lnYk0yMaA/atdIsg==
21572157

2158+
"@types/node@20.6.0":
2159+
version "20.6.0"
2160+
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.0.tgz#9d7daa855d33d4efec8aea88cd66db1c2f0ebe16"
2161+
integrity sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==
2162+
21582163
"@types/parse-json@^4.0.0":
21592164
version "4.0.0"
21602165
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
21612166
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==
21622167

2168+
"@types/prop-types@*":
2169+
version "15.7.5"
2170+
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
2171+
integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==
2172+
2173+
"@types/react@18.2.21":
2174+
version "18.2.21"
2175+
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.21.tgz#774c37fd01b522d0b91aed04811b58e4e0514ed9"
2176+
integrity sha512-neFKG/sBAwGxHgXiIxnbm3/AAVQ/cMRS93hvBpg8xYRbeQSPVABp9U2bRnPf0iI4+Ucdv3plSxKK+3CW2ENJxA==
2177+
dependencies:
2178+
"@types/prop-types" "*"
2179+
"@types/scheduler" "*"
2180+
csstype "^3.0.2"
2181+
2182+
"@types/scheduler@*":
2183+
version "0.16.3"
2184+
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5"
2185+
integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==
2186+
21632187
"@types/stylis@^4.0.2":
21642188
version "4.2.0"
21652189
resolved "https://registry.yarnpkg.com/@types/stylis/-/stylis-4.2.0.tgz#199a3f473f0c3a6f6e4e1b17cdbc967f274bdc6b"
@@ -3540,6 +3564,11 @@ tslib@^2.0.0, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.4.0, tslib@^2.5.0:
35403564
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
35413565
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
35423566

3567+
typescript@5.2.2:
3568+
version "5.2.2"
3569+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
3570+
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==
3571+
35433572
unicode-canonical-property-names-ecmascript@^2.0.0:
35443573
version "2.0.0"
35453574
resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc"

0 commit comments

Comments
 (0)