Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/(pages)/_components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* eslint-disable prettier/prettier */
import Link from 'next/link';
import styles from './Footer.module.scss';
import links from '../../../../links';

interface NavLink {
name: string;
Expand Down Expand Up @@ -42,7 +44,7 @@ export default function Footer({ navLinks }: { navLinks: NavLink[] }) {
<div>
<Link href="/project/4">Project 4</Link>
<Link href="/project/5">Project 5</Link>
<Link href="/project/6">Project 6</Link>
<Link href={links.shiba_pillow} target='_blank'>Project 6</Link>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styles from './CreateUsersForm.module.scss';

import { CreateUser } from '@actions/users/CreateUsers';
import { CreateUser } from '../../../../api/_actions/users/CreateUsers';
export default function CreateUserForm() {
return (
<div className={styles.form_container}>
Expand Down
4 changes: 2 additions & 2 deletions app/(pages)/users/_components/UserCard/UserCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styles from './UserCard.module.scss';
import { UpdateUser } from '@actions/users/UpdateUsers';
import type User from '@datatypes/User';
import { UpdateUser } from '../../../../api/_actions/users/UpdateUsers';
import type User from '../../../../api/_types/User';

export default function PokemonCard({ user }: { user: User }) {
const UpdatePokemonWithId = UpdateUser.bind(null, user.id);
Expand Down
6 changes: 3 additions & 3 deletions app/(pages)/users/_components/UsersList/UsersList.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import styles from './UsersList.module.scss';

import type User from '@datatypes/User';
import type User from '../../../../api/_types/User';
import UserCard from '../UserCard/UserCard';
import { getClient } from '@utils/apollo/ApolloClient';
import { usersQuery } from '@graphql/queries/users';
import { getClient } from '../../../../api/_utils/apollo/ApolloClient';
import { usersQuery } from '../../../../api/_graphql/queries/users';

export default async function UsersList() {
const users = await getClient().query({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use server';

import { revalidatePath } from 'next/cache';
import { getClient } from '@utils/apollo/ApolloClient';
import { getClient } from '../../_utils/apollo/ApolloClient';
import FormToJSON from '@utils/form/FormToJSON';

import { createUserMutation } from '@graphql/mutations/createUser';
import { createUserMutation } from '../../_graphql/mutations/createUser';

export async function CreateUser(formData: FormData) {
const dataJSON = FormToJSON(formData);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use server';

import { revalidatePath } from 'next/cache';
import { getClient } from '@utils/apollo/ApolloClient';
import { getClient } from '../../_utils/apollo/ApolloClient';
import FormToJSON from '@utils/form/FormToJSON';

import { updateUserMutation } from '@graphql/mutations/updateUser';
import { updateUserMutation } from '../../_graphql/mutations/updateUser';

export async function UpdateUser(id: string, formData: FormData) {
const dataJSON = FormToJSON(formData);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions app/api/webhook/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-disable prettier/prettier */
import Stripe from "stripe";
import { NextResponse, NextRequest } from "next/server";

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
export async function POST(req: NextRequest) {
const payload = await req.text();
const res = JSON.parse(payload);

const sig = req.headers.get("Stripe-Signature");

const dateTime = new Date(res?.created * 1000).toLocaleDateString();
const timeString = new Date(res?.created * 1000).toLocaleDateString();

try {
const event = stripe.webhooks.constructEvent(
payload,
sig!,
process.env.STRIPE_WEBHOOK_SECRET!
);

console.log(res.data)

return NextResponse.json({ status: "success", event: event.type, response: res });
} catch (error) {
return NextResponse.json({ status: "Failed", error });
}
}
5 changes: 5 additions & 0 deletions links.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const productLinks = {
shiba_pillow: 'https://buy.stripe.com/test_14kcOLd0v4fb6AgaEE',
};

export default productLinks;
Loading