Skip to content
Snippets Groups Projects
Commit ce972e7e authored by Damyan Mitev's avatar Damyan Mitev :beach:
Browse files

implement WopiAPI.createDocument

parent cacc4624
No related branches found
No related tags found
1 merge request!48269 implement workflow for signing already uploaded document dev
import {encodeResponse} from "../utilities/appUtility";
const axios = require('axios');
function WopiAPI() {}
......@@ -20,6 +22,31 @@ WopiAPI.prototype.getPassports = function (resourceID, contentType) {
return axios(requestConfig);
};
WopiAPI.prototype.createDocument = async (passportUUID, path, contentType, title) => {
const authenticationPublicKey = localStorage.getItem("authenticatedIdentity");
if (
!authenticationPublicKey ||
!window.loadedIdentities[authenticationPublicKey] ||
!extendPinCodeTtl(authenticationPublicKey)
) {
return encodeResponse("400", "", "Identity not authenticated");
}
const config = {
headers: {
path,
passportuuid: passportUUID,
contentType,
title
}
};
const response = await executeRestfulFunction("private", window.viamApi, window.viamApi.documentCreateDocument,
config);
const resourceID = response.data;
return await this.getPassports(resourceID, contentType);
};
WopiAPI.prototype.putDocument = function (resourceID, accessToken, file) {
const { publicKey, uuid, token, deviceHash } = window.viamApi.getConfig().headers;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment