mirror of
https://git.v0l.io/Kieran/void.cat.git
synced 2025-03-29 16:01:43 +01:00
Add API_HOST to upload/download
This commit is contained in:
parent
d82c43bb3e
commit
bd2464bd47
@ -1,7 +1,5 @@
|
||||
import {useSelector} from "react-redux";
|
||||
import preval from "preval.macro";
|
||||
|
||||
const ApiHost = preval`module.exports = process.env.API_HOST || '';`;
|
||||
import {ApiHost} from "./Const";
|
||||
|
||||
export function useApi() {
|
||||
const auth = useSelector(state => state.login.jwt);
|
||||
|
@ -1,3 +1,7 @@
|
||||
import preval from "preval.macro";
|
||||
|
||||
export const ApiHost = preval`module.exports = process.env.API_HOST || '';`;
|
||||
|
||||
/**
|
||||
* @constant {number} - Size of 1 kiB
|
||||
*/
|
||||
|
@ -8,6 +8,7 @@ import {FilePaywall} from "./FilePaywall";
|
||||
import {useApi} from "./Api";
|
||||
import {Helmet} from "react-helmet";
|
||||
import {FormatBytes} from "./Util";
|
||||
import {ApiHost} from "./Const";
|
||||
|
||||
export function FilePreview() {
|
||||
const {Api} = useApi();
|
||||
@ -92,9 +93,9 @@ export function FilePreview() {
|
||||
if (order) {
|
||||
let orderObj = JSON.parse(order);
|
||||
setOrder(orderObj);
|
||||
setLink(`/d/${info.id}?orderId=${orderObj.id}`);
|
||||
setLink(`${ApiHost}/d/${info.id}?orderId=${orderObj.id}`);
|
||||
} else {
|
||||
setLink(`/d/${info.id}`);
|
||||
setLink(`${ApiHost}/d/${info.id}`);
|
||||
}
|
||||
}
|
||||
}, [info]);
|
||||
|
@ -120,6 +120,7 @@ export function FileUpload(props) {
|
||||
if (typeof (editSecret) === "string") {
|
||||
req.setRequestHeader("V-EditSecret", editSecret);
|
||||
}
|
||||
req.withCredentials = true;
|
||||
req.send(segment);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user