Browse Source

Update ImageList.js

AY 4 năm trước cách đây
mục cha
commit
e747f636c7
1 tập tin đã thay đổi với 15 bổ sung12 xóa
  1. 15 12
      photo/src/ImageList.js

+ 15 - 12
photo/src/ImageList.js

@@ -66,9 +66,11 @@ class imageList extends React.Component {
         });
     }
 
-    shareImage() {
-        this.setState({ open: true, currentImagePath: this.state.images[this.state.currentImage].src });
-        fetch("/backend_test/share?path=" + this.state.currentImagePath, {})
+    shareImage = () => {
+        var CIP = this.state.images[this.state.currentImage].src;
+        this.setState({ open: true, currentImagePath: CIP });
+        fetch("/system/file_system/share/new?path=" + CIP, {})
+        //fetch("/backend_test/new?path=" + CIP, {})
             .then(res => res.json())
             .then(
                 (result) => {
@@ -101,9 +103,11 @@ class imageList extends React.Component {
         var uuid = this.state.uuid;
         var mode = event.target.value;
         var path = this.state.currentImagePath;
+
         if (event.target.value != "remove") {
             //this.setState({ currency: event.target.value });
-            fetch('/backend_test/edit?uuid=' + uuid + '&mode=' + mode, {
+            //fetch('/backend_test/edit?uuid=' + uuid + '&mode=' + mode, {
+            fetch('/system/file_system/edit?uuid=' + uuid + '&mode=' + mode, {
                 method: 'GET',
                 headers: {
                     'Content-Type': 'application/json'
@@ -113,7 +117,8 @@ class imageList extends React.Component {
                 .then((data) => data);
         } else {
             //remove but use edit response now
-            fetch("/backend_test/remove?path=" + path, {
+            //fetch("/backend_test/remove?path=" + path, {
+            fetch('/system/file_system/remove?uuid=' + uuid + '&mode=' + mode, {
                 method: 'GET',
                 headers: {
                     'Content-Type': 'application/json'
@@ -125,8 +130,8 @@ class imageList extends React.Component {
     }
     
     componentDidMount() {
-        fetch("/backend_test/listFile", {})
-        /*
+       // fetch("/backend_test/listFile", {})
+        
         fetch("/system/ajgi/interface?script=/Photo/backend/listFile.js", {
                 method: 'post',
                 headers: {
@@ -135,7 +140,7 @@ class imageList extends React.Component {
                 },
                 body: JSON.stringify({ folder: this.props.path })
             })
-            */
+            
             .then(res => res.json())
             .then(
                 (result) => {
@@ -184,7 +189,6 @@ class imageList extends React.Component {
                 customControls={[
                     <Button
                         variant="contained"
-                        color="primary"
                         size="large"
                         style={theme}
                         startIcon={<ShareIcon />}
@@ -213,14 +217,14 @@ class imageList extends React.Component {
                         </DialogTitle>
                         <DialogContent>
                             <TextField
-                                label="The link"
+                                label="Shared link"
                                 defaultValue="https://arozos.com/share/not_found"
                                 InputProps={{
                                     readOnly: true,
                                 }}
                                 variant="filled"
                                 fullWidth="true"
-                                value={this.state.uuid}
+                                value={window.location.origin + "/share?id=" + this.state.uuid}
                             />
                             <br/><br/>
                             <TextField
@@ -231,7 +235,6 @@ class imageList extends React.Component {
                                 SelectProps={{
                                     native: true,
                                 }}
-                                helperText="Please select your share otion"
                                 variant="outlined"
                                 fullWidth="true"
                             >