Doceditor:Utils:Action Added getFillingSession
This commit is contained in:
parent
271f4a7f87
commit
571cbdff47
@ -24,6 +24,7 @@
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
import { CompletedForm } from "@/components/completed-form";
|
||||
import { getFillingSession } from "@/utils/actions";
|
||||
|
||||
interface PageProps {
|
||||
searchParams: Record<string, string | undefined>;
|
||||
@ -32,7 +33,11 @@ interface PageProps {
|
||||
async function Page({ searchParams }: PageProps) {
|
||||
const { share, fileId, fillingSessionId } = searchParams;
|
||||
|
||||
console.log({ share, fileId, fillingSessionId });
|
||||
console.log({ fillingSessionId, fileId, share });
|
||||
|
||||
const session = await getFillingSession(fillingSessionId!, share);
|
||||
|
||||
console.log({ session });
|
||||
|
||||
return <CompletedForm />;
|
||||
}
|
||||
|
@ -48,6 +48,34 @@ import type {
|
||||
|
||||
import { REPLACED_URL_PATH } from "./constants";
|
||||
|
||||
export async function getFillingSession(
|
||||
fillingSessionId: string,
|
||||
share?: string,
|
||||
) {
|
||||
const [request] = createRequest(
|
||||
[`/files/file/fillresult?fillingSessionId=${fillingSessionId}`],
|
||||
[
|
||||
["Content-Type", "application/json;charset=utf-8"],
|
||||
share ? ["Request-Token", share] : ["", ""],
|
||||
],
|
||||
"GET",
|
||||
);
|
||||
|
||||
try {
|
||||
console.log({ request });
|
||||
|
||||
const response = await fetch(request);
|
||||
|
||||
if (response.ok) return await response.json();
|
||||
|
||||
throw new Error("Something went wrong", {
|
||||
cause: await response.json(),
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("File copyas error ", error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function fileCopyAs(
|
||||
fileId: string,
|
||||
destTitle: string,
|
||||
|
Loading…
Reference in New Issue
Block a user