mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-09-01 18:35:24 +00:00
Move to dev brach
This commit is contained in:
@@ -64,7 +64,7 @@ import { Editor } from "@monaco-editor/react";
|
|||||||
import { db } from "../data/db";
|
import { db } from "../data/db";
|
||||||
import { useLiveQuery } from "dexie-react-hooks";
|
import { useLiveQuery } from "dexie-react-hooks";
|
||||||
import { socket } from "../data/socket";
|
import { socket } from "../data/socket";
|
||||||
import { useCookies } from "react-cookie";
|
// import { useCookies } from "react-cookie";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
export default function ControlPanel({
|
export default function ControlPanel({
|
||||||
@@ -110,7 +110,7 @@ export default function ControlPanel({
|
|||||||
message: "",
|
message: "",
|
||||||
});
|
});
|
||||||
const [data, setData] = useState(null);
|
const [data, setData] = useState(null);
|
||||||
const [cookies] = useCookies(["logged_in"]);
|
// const [cookies] = useCookies(["logged_in"]);
|
||||||
const [addPeople, setAddPeople] = useState([])
|
const [addPeople, setAddPeople] = useState([])
|
||||||
const { layout, setLayout } = useContext(LayoutContext);
|
const { layout, setLayout } = useContext(LayoutContext);
|
||||||
const { settings, setSettings } = useContext(SettingsContext);
|
const { settings, setSettings } = useContext(SettingsContext);
|
||||||
@@ -1293,26 +1293,29 @@ export default function ControlPanel({
|
|||||||
createNewDiagram(selectedTemplateId);
|
createNewDiagram(selectedTemplateId);
|
||||||
return;
|
return;
|
||||||
case MODAL.SHARE:
|
case MODAL.SHARE:
|
||||||
|
// if (cookies.logged_in) {
|
||||||
await axios
|
await axios
|
||||||
.post(
|
.post(
|
||||||
`${import.meta.env.VITE_API_BACKEND_URL}/share`,
|
`${import.meta.env.VITE_API_BACKEND_URL}/share`,
|
||||||
{
|
{
|
||||||
people: addPeople,
|
people: addPeople,
|
||||||
diagram: {
|
diagram: JSON.stringify({
|
||||||
name: title,
|
name: title,
|
||||||
tables: tables,
|
tables: tables,
|
||||||
references: relationships,
|
references: relationships,
|
||||||
types: types,
|
types: types,
|
||||||
notes: notes,
|
notes: notes,
|
||||||
areas: areas,
|
areas: areas,
|
||||||
}
|
})
|
||||||
},
|
},
|
||||||
{ withCredentials: true }
|
// { withCredentials: true }
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
|
// window.location = window.location + '/sup'
|
||||||
})
|
})
|
||||||
.catch((e) => console.log(e));
|
.catch((e) => console.log(e));
|
||||||
|
// }
|
||||||
setVisible(MODAL.NONE)
|
setVisible(MODAL.NONE)
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
@@ -1583,7 +1586,7 @@ export default function ControlPanel({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
case MODAL.SHARE:
|
case MODAL.SHARE:
|
||||||
if (cookies.logged_in) {
|
// if (cookies.logged_in) {
|
||||||
return <div>
|
return <div>
|
||||||
<TagInput
|
<TagInput
|
||||||
placeholder='Add people'
|
placeholder='Add people'
|
||||||
@@ -1602,11 +1605,11 @@ export default function ControlPanel({
|
|||||||
<div className="opacity-60">Owner</div>
|
<div className="opacity-60">Owner</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
} else {
|
// } else {
|
||||||
return <div>
|
// return <div>
|
||||||
You'll need to <Link to="/login" target="_blank" className="text-blue-600 font-bold hover:underline">log in</Link> before you can share this diagram.
|
// You'll need to <Link to="/login" target="_blank" className="text-blue-600 font-bold hover:underline">log in</Link> before you can share this diagram.
|
||||||
</div>
|
// </div>
|
||||||
}
|
// }
|
||||||
default:
|
default:
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user