Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
GraemeFulton committed Jul 29, 2024
1 parent 41bef48 commit 10845aa
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 33 deletions.
68 changes: 40 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"react-avatar-editor": "^12.0.0",
"react-chartjs-2": "^4.3.1",
"react-data-table-component": "^7.5.3",
"react-datepicker": "^4.8.0",
"react-datepicker": "^4.25.0",
"react-day-picker": "^8.3.6",
"react-device-detect": "^2.2.2",
"react-dom": "^18.2.0",
Expand Down Expand Up @@ -179,13 +179,14 @@
"swr": "^1.3.0",
"tailwindcss-border-gradient-radius": "^3.0.1",
"tinycolor2": "^1.4.1",
"tiptypr": "^0.0.594",
"tippy.js": "^6.3.7",
"tiptypr": "^0.0.599",
"tsparticles": "^2.7.1",
"uuidv4": "^6.2.13",
"yup": "^0.32.11"
},
"optionalDependencies": {
"@prototypr/paper-interview": "^0.0.24",
"@prototypr/paper-interview": "^0.0.28",
"@prototypr/prototypr-postie": "^1.0.9"
},
"resolutions": {
Expand Down
21 changes: 19 additions & 2 deletions pages/api/interview/generate.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { userCheck } from "@/lib/account/userCheck";
// import { userCheck } from "@/lib/account/userCheck";
import { getIronSession } from "iron-session";
import { sessionOptions } from "@/lib/iron-session/session";
import {generate} from "@prototypr/paper-interview/dist/api/generate"
export const runtime = "edge";
export const dynamic = "force-dynamic";

const getSession = async (req, res) =>{
const session = await getIronSession(req, res, sessionOptions);
return session
}

async function handler(req, res) {
if (req.method !== "POST") {
return new Response(JSON.stringify({ error: "Method not allowed" }), {
Expand All @@ -14,7 +19,19 @@ async function handler(req, res) {
}

try {
const { userId, user } = userCheck({ req, res, requireAuth: false });
const session = await getSession(req, res)
const user = session.user

if(!user?.login?.jwt){
console.log('no token')
return res.status(200).json({status:500,message:"User is not authenticated - invalid token"});
}

const userId = user?.login?.user?.id

if (!userId) {
return res.status(500).end("User is not authenticated");
}

if (userId) {
// Call generate and get the stream
Expand Down
3 changes: 3 additions & 0 deletions pages/p/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const EditorWrapper = dynamic(() => import("tiptypr/dist/EditorWrapper"), {
ssr: false
});
import 'tiptypr/dist/styles.css';
import 'tippy.js/dist/svg-arrow.css';
import 'tippy.js/animations/scale-subtle.css';
import "react-datepicker/dist/react-datepicker.css";

/**
*
Expand Down
5 changes: 5 additions & 0 deletions pages/toolbox/post/[id]/interview/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import useUser from "@/lib/iron-session/useUser";
import dynamic from 'next/dynamic';

import '@prototypr/paper-interview/dist/styles.css';
import 'tiptypr/dist/styles.css';
import 'tippy.js/dist/svg-arrow.css';
import 'tippy.js/animations/scale-subtle.css';
import "react-datepicker/dist/react-datepicker.css";


const EditorWrapper = dynamic(() => import("tiptypr/dist/EditorWrapper"), {
ssr: false
Expand Down
3 changes: 3 additions & 0 deletions pages/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ const EditorWrapper = dynamic(() => import("tiptypr/dist/EditorWrapper"), {
ssr: false
});
import 'tiptypr/dist/styles.css';
import 'tippy.js/dist/svg-arrow.css';
import 'tippy.js/animations/scale-subtle.css';
import "react-datepicker/dist/react-datepicker.css";

/**
* Write
Expand Down

0 comments on commit 10845aa

Please sign in to comment.