Skip to content

Commit

Permalink
github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf committed Jul 16, 2024
1 parent 818838c commit eee3ef3
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 247 deletions.
25 changes: 0 additions & 25 deletions app/admin/page.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions app/api/revalidate/route.ts

This file was deleted.

96 changes: 0 additions & 96 deletions app/api/token/route.ts

This file was deleted.

24 changes: 0 additions & 24 deletions app/node/[id]/page.tsx

This file was deleted.

31 changes: 0 additions & 31 deletions app/redirect/page.tsx

This file was deleted.

26 changes: 1 addition & 25 deletions app/wiki/[...id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import {
import { PrevNext } from "@/components/prev-next";
import { getNode } from "@/services/get-node";
import { getDocBlocks } from "@/services/get-doc-blocks";
import { revalidateTag } from "next/cache";
import { FormLoading } from "@/components/form-loading";
import { DateModified } from "@/components/date-modified";
import { Admin } from "@/components/admin";
import { NodesData } from "@/services/larkServices";

interface Props {
Expand Down Expand Up @@ -44,22 +41,10 @@ export default async function Document({ params }: Props) {
if (!id) {
redirect("/404");
}
const { data, docx_token, edit_time } = await getData(id!);
const { data, edit_time } = await getData(id!);

const slugger = new GithubSlugger();

async function invalidatePage(formData: FormData) {
"use server";

const id = formData.get("id");
if (typeof id === "string") revalidateTag(id);

const docx_token = formData.get("docx_token");
if (typeof docx_token === "string") revalidateTag(docx_token);

console.log("revalidating", id, docx_token);
}

return (
<main className="flex overflow-x-hidden">
<div className="w-2/3">
Expand All @@ -73,15 +58,6 @@ export default async function Document({ params }: Props) {
))}
<PrevNext />
<DateModified date={new Date(Number(edit_time) * 1000)} />
<Admin>
<form action={invalidatePage}>
<input name="id" type="hidden" value={id} />
<input name="docx_token" type="hidden" value={docx_token} />
<FormLoading className="bg-red-700 text-white rounded-sm p-2 mb-8 inline-block">
invalidate page
</FormLoading>
</form>
</Admin>
</div>
<aside className="w-1/3">
<TableOfContents allItems={data} />
Expand Down
11 changes: 1 addition & 10 deletions components/blocks/child-pages.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
"use server";

import { key } from "@/lib/utils";
import { Item } from "./common";
import { getChildNodes } from "@/services/get-child-nodes";
import { getPath } from "@/services/get-path";
import Link from "next/link";

import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Card, CardHeader, CardTitle } from "@/components/ui/card";

export interface ChildPages extends Item {
block_type: 42;
Expand Down
3 changes: 1 addition & 2 deletions lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"use server";
import { getTenantAccessToken } from "@/services/get-tenant-access-token";
import { backOff } from "exponential-backoff";

Expand All @@ -18,4 +17,4 @@ export const fetcher = async <T = any>(
);

return await res.json();
};
};
1 change: 1 addition & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const nextConfig = {
workerThreads: false,
cpus: 1,
},
output: "export",
};

export default nextConfig;
2 changes: 0 additions & 2 deletions services/get-search-config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use server";

import { getTopLevelNodes } from "./get-top-level-nodes";
import { listTableRecords } from "./list-table-records";
import { listTables } from "./list-tables";
Expand Down
2 changes: 0 additions & 2 deletions services/get-tenant-access-token.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use server";

export async function getTenantAccessToken() {
const res = await fetch(
`https://open.larksuite.com/open-apis/auth/v3/tenant_access_token/internal`,
Expand Down

0 comments on commit eee3ef3

Please sign in to comment.