Skip to content
Snippets Groups Projects
Commit 34694c30 authored by Alexey Lunin's avatar Alexey Lunin
Browse files

pretrier

parent 0ab5ed8d
No related branches found
No related tags found
1 merge request!49Applied prettier to the VCL project
This diff is collapsed.
const axios = require('axios');
const axios = require("axios");
function WopiAPI() {}
WopiAPI.prototype.getPassports = function (resourceID, contentType) {
const { publicKey, uuid, token, deviceHash } = window.viamApi.getConfig().headers;
WopiAPI.prototype.getPassports = function(resourceID, contentType) {
const {
publicKey,
uuid,
token,
deviceHash
} = window.viamApi.getConfig().headers;
const requestConfig = {
url: `${window.WOPI_URL}getPassports`,
method: 'POST',
method: "POST",
headers: {
publicKey,
uuid,
......@@ -20,13 +25,18 @@ WopiAPI.prototype.getPassports = function (resourceID, contentType) {
return axios(requestConfig);
};
WopiAPI.prototype.putDocument = function (resourceID, accessToken, file) {
const { publicKey, uuid, token, deviceHash } = window.viamApi.getConfig().headers;
WopiAPI.prototype.putDocument = function(resourceID, accessToken, file) {
const {
publicKey,
uuid,
token,
deviceHash
} = window.viamApi.getConfig().headers;
resourceID = encodeURI(resourceID);
const requestConfig = {
url: `${window.WOPI_URL}files/${resourceID}/contents`,
method: 'POST',
method: "POST",
headers: {
publicKey,
uuid,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
export const stringToUtf8ByteArray = (str) => {
if (typeof str !== 'string') {
export const stringToUtf8ByteArray = str => {
if (typeof str !== "string") {
str = str.toString();
}
const res = Buffer.from(str, 'utf-8');
const res = Buffer.from(str, "utf-8");
return res;
}
};
export const utf8ByteArrayToString = (ba) => {
export const utf8ByteArrayToString = ba => {
if (!Buffer.isBuffer(ba)) {
ba = Buffer.from(ba);
}
const res = ba.toString('utf-8');
const res = ba.toString("utf-8");
return res;
}
};
export const stringToUtf8Base64 = (str) => {
export const stringToUtf8Base64 = str => {
if (!Buffer.isBuffer(str)) {
if (typeof str !== 'string') {
if (typeof str !== "string") {
str = str.toString();
}
str = Buffer.from(str, 'utf-8');
str = Buffer.from(str, "utf-8");
}
const res = str.toString('base64');
const res = str.toString("base64");
return res;
}
};
export const utf8Base64ToString = (strBase64) => {
export const utf8Base64ToString = strBase64 => {
if (!Buffer.isBuffer(strBase64)) {
if (typeof strBase64 !== 'string') {
if (typeof strBase64 !== "string") {
strBase64 = strBase64.toString();
}
strBase64 = Buffer.from(strBase64, 'base64');
strBase64 = Buffer.from(strBase64, "base64");
}
const res = strBase64.toString('utf-8');
const res = strBase64.toString("utf-8");
return res;
}
};
export const base64ToByteArray = (strBase64) => {
if (typeof strBase64 !== 'string') {
export const base64ToByteArray = strBase64 => {
if (typeof strBase64 !== "string") {
strBase64 = strBase64.toString();
}
const res = Buffer.from(strBase64, 'base64');
const res = Buffer.from(strBase64, "base64");
return res;
}
};
export const byteArrayToBase64 = (ba) => {
export const byteArrayToBase64 = ba => {
if (!Buffer.isBuffer(ba)) {
ba = Buffer.from(ba);
}
const res = ba.toString('base64');
const res = ba.toString("base64");
return res;
}
};
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