Switch hashes to smaller IDs for the backend (#474)
* Update backend * log
This commit is contained in:
parent
d44c4ca2d8
commit
4487e9af8a
@ -141,6 +141,7 @@ export function ExportDialog({
|
|||||||
<Stack.Row gap={1} align="baseline">
|
<Stack.Row gap={1} align="baseline">
|
||||||
{scales.map(s => (
|
{scales.map(s => (
|
||||||
<ToolIcon
|
<ToolIcon
|
||||||
|
key={s}
|
||||||
size="s"
|
size="s"
|
||||||
type="radio"
|
type="radio"
|
||||||
icon={"x" + s}
|
icon={"x" + s}
|
||||||
|
@ -184,21 +184,21 @@ export async function exportToBackend(elements: readonly ExcalidrawElement[]) {
|
|||||||
body: serializeAsJSON(elements)
|
body: serializeAsJSON(elements)
|
||||||
});
|
});
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
if (json.hash) {
|
if (json.id) {
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
url.searchParams.append("json", json.hash);
|
url.searchParams.append("json", json.id);
|
||||||
|
|
||||||
await navigator.clipboard.writeText(url.toString());
|
await navigator.clipboard.writeText(url.toString());
|
||||||
window.alert("Copied shareable link " + url.toString() + " to clipboard");
|
window.alert(`Copied shareable link ${url.toString()} to clipboard`);
|
||||||
} else {
|
} else {
|
||||||
window.alert("Couldn't create shareable link");
|
window.alert("Couldn't create shareable link");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function importFromBackend(hash: string | null) {
|
export async function importFromBackend(id: string | null) {
|
||||||
let elements: readonly ExcalidrawElement[] = [];
|
let elements: readonly ExcalidrawElement[] = [];
|
||||||
let appState: AppState = getDefaultAppState();
|
let appState: AppState = getDefaultAppState();
|
||||||
const response = await fetch(`${BACKEND_GET}${hash}.json`).then(data =>
|
const response = await fetch(`${BACKEND_GET}${id}.json`).then(data =>
|
||||||
data.clone().json()
|
data.clone().json()
|
||||||
);
|
);
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user