Spaces:
Running
Running
uploader
Browse files- hooks/useEditor.ts +5 -0
hooks/useEditor.ts
CHANGED
|
@@ -8,10 +8,12 @@ import { defaultHTML } from "@/lib/consts";
|
|
| 8 |
import { Commit, Page, Project } from "@/types";
|
| 9 |
import { api } from "@/lib/api";
|
| 10 |
import { isTheSameHtml } from "@/lib/compare-html-diff";
|
|
|
|
| 11 |
|
| 12 |
export const useEditor = (namespace?: string, repoId?: string) => {
|
| 13 |
const client = useQueryClient();
|
| 14 |
const router = useRouter();
|
|
|
|
| 15 |
|
| 16 |
const { data: project, isFetching: isLoadingProject } = useQuery({
|
| 17 |
queryKey: ["editor.project"],
|
|
@@ -218,6 +220,9 @@ export const useEditor = (namespace?: string, repoId?: string) => {
|
|
| 218 |
{
|
| 219 |
method: "POST",
|
| 220 |
body: data,
|
|
|
|
|
|
|
|
|
|
| 221 |
}
|
| 222 |
);
|
| 223 |
|
|
|
|
| 8 |
import { Commit, Page, Project } from "@/types";
|
| 9 |
import { api } from "@/lib/api";
|
| 10 |
import { isTheSameHtml } from "@/lib/compare-html-diff";
|
| 11 |
+
import { useUser } from "./useUser";
|
| 12 |
|
| 13 |
export const useEditor = (namespace?: string, repoId?: string) => {
|
| 14 |
const client = useQueryClient();
|
| 15 |
const router = useRouter();
|
| 16 |
+
const { token } = useUser();
|
| 17 |
|
| 18 |
const { data: project, isFetching: isLoadingProject } = useQuery({
|
| 19 |
queryKey: ["editor.project"],
|
|
|
|
| 220 |
{
|
| 221 |
method: "POST",
|
| 222 |
body: data,
|
| 223 |
+
headers: {
|
| 224 |
+
"Authorization": `Bearer ${token}`,
|
| 225 |
+
},
|
| 226 |
}
|
| 227 |
);
|
| 228 |
|