mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-09 08:08:12 -05:00
feat(plex/utils): added Plex OAuth class
This commit is contained in:
12
src/pages/_app.tsx
Normal file
12
src/pages/_app.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
import '../styles/globals.css';
|
||||
import App from 'next/app';
|
||||
|
||||
class CoreApp extends App {
|
||||
public render(): JSX.Element {
|
||||
const { Component, pageProps } = this.props;
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
}
|
||||
|
||||
export default CoreApp;
|
||||
13
src/pages/index.tsx
Normal file
13
src/pages/index.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
import { NextPage } from 'next';
|
||||
|
||||
const Index: NextPage = () => {
|
||||
return (
|
||||
<div className="bg-blue-700 mx-4 my-2 px-4 py-2 w-64">
|
||||
<h1 className="text-xl">Overseer</h1>
|
||||
<p className="py-4">Here is some text</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Index;
|
||||
39
src/pages/plextest.tsx
Normal file
39
src/pages/plextest.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import React, { useState } from 'react';
|
||||
import { NextPage } from 'next';
|
||||
import PlexOAuth from '../utils/plex';
|
||||
|
||||
const plexOAuth = new PlexOAuth();
|
||||
|
||||
const PlexText: NextPage = () => {
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [authToken, setAuthToken] = useState<string>('');
|
||||
|
||||
const getPlexLogin = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const authToken = await plexOAuth.login();
|
||||
setAuthToken(authToken);
|
||||
setLoading(false);
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div>
|
||||
<span className="inline-flex rounded-md shadow-sm">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => getPlexLogin()}
|
||||
disabled={loading}
|
||||
className="inline-flex items-center px-6 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:shadow-outline-indigo active:bg-indigo-700 transition ease-in-out duration-150"
|
||||
>
|
||||
{loading ? 'Loading...' : 'Plex Login'}
|
||||
</button>
|
||||
</span>
|
||||
<div className="mt-4">Auth Token: {authToken}</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default PlexText;
|
||||
Reference in New Issue
Block a user