2020-07-02 09:38:39 +03:00
|
|
|
import * as React from "react";
|
2020-08-07 02:50:05 +03:00
|
|
|
import * as System from "~/dist";
|
2020-07-02 09:38:39 +03:00
|
|
|
|
2020-07-29 02:08:38 +03:00
|
|
|
import { css } from "@emotion/react";
|
|
|
|
|
|
|
|
const STYLES_FILE_HIDDEN = css`
|
|
|
|
height: 1px;
|
|
|
|
width: 1px;
|
|
|
|
opacity: 0;
|
|
|
|
visibility: hidden;
|
|
|
|
position: fixed;
|
|
|
|
top: -1px;
|
|
|
|
left: -1px;
|
|
|
|
`;
|
|
|
|
|
2020-07-16 08:48:51 +03:00
|
|
|
export default class SlateReactSystemPage extends React.Component {
|
2020-08-06 23:52:47 +03:00
|
|
|
async componentDidMount() {
|
|
|
|
const url = "/api/v1/get";
|
|
|
|
const response = await fetch(url, {
|
|
|
|
method: "POST",
|
|
|
|
headers: {
|
|
|
|
Authorization: "Basic --",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const json = await response.json();
|
|
|
|
console.log(json);
|
|
|
|
}
|
|
|
|
|
2020-07-29 02:08:38 +03:00
|
|
|
_handleUpload = async (e) => {
|
|
|
|
e.persist();
|
|
|
|
|
|
|
|
const url = "/api/v1/upload-data/--";
|
|
|
|
let file = e.target.files[0];
|
|
|
|
let data = new FormData();
|
|
|
|
|
2020-08-03 19:41:26 +03:00
|
|
|
data.append("data", file);
|
2020-07-29 02:08:38 +03:00
|
|
|
const response = await fetch(url, {
|
|
|
|
method: "POST",
|
|
|
|
headers: {
|
|
|
|
Authorization: "Basic --",
|
|
|
|
},
|
|
|
|
body: data,
|
|
|
|
});
|
|
|
|
|
|
|
|
const json = await response.json();
|
|
|
|
console.log(json);
|
|
|
|
};
|
|
|
|
|
2020-07-02 09:38:39 +03:00
|
|
|
render() {
|
2020-07-02 11:24:14 +03:00
|
|
|
console.log(System.Constants);
|
2020-07-16 04:36:29 +03:00
|
|
|
|
2020-07-02 09:38:39 +03:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<System.H1>Component Library Test</System.H1>
|
|
|
|
<br />
|
|
|
|
<br />
|
2020-08-06 23:52:47 +03:00
|
|
|
<System.P>
|
|
|
|
If this works. That means the component library bundle is working
|
|
|
|
correctly.
|
|
|
|
</System.P>
|
2020-08-02 02:20:25 +03:00
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<div style={{ marginTop: 24 }}>
|
2020-08-06 23:52:47 +03:00
|
|
|
<input
|
|
|
|
css={STYLES_FILE_HIDDEN}
|
|
|
|
type="file"
|
|
|
|
id="file"
|
|
|
|
onChange={this._handleUpload}
|
|
|
|
/>
|
|
|
|
<System.ButtonPrimary
|
|
|
|
style={{ margin: "0 16px 16px 0" }}
|
|
|
|
type="label"
|
|
|
|
htmlFor="file"
|
|
|
|
>
|
2020-09-13 04:12:56 +03:00
|
|
|
Upload file To network with API
|
2020-08-02 02:20:25 +03:00
|
|
|
</System.ButtonPrimary>
|
|
|
|
<System.TooltipAnchor tooltip="Hello friends!!" />
|
|
|
|
</div>
|
2020-07-02 09:38:39 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|