mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-16 06:42:14 +00:00
Saving and Loading of Scenes - Save New scene to server implemented - Retrieving sceneToken from new scene and refreshes URL, which brings the editor to state of editing an existing Scene - Optimized scene reloading when URL changes - Save Existing scene to server implemented - Rename scene to server implemented - Optimized Scene Renaming Component and Endpoint Operation Editor Changes and Fixes: - changed the way the api_manager retrieve session tokens - changed the way api_manager uses a fetcher for the operations in saving scenes Co-authored-by: wil <wil@storyteller.ai>
33 lines
774 B
TypeScript
33 lines
774 B
TypeScript
import { renameScene as renameSceneEndpoint } from "~/api";
|
|
|
|
export const renameScene = async (
|
|
sceneTitle: string,
|
|
sceneToken: string,
|
|
sessionToken: string,
|
|
) => {
|
|
const endpoint = renameSceneEndpoint(sceneToken);
|
|
// console.log(`rename ${sceneToken}: ${sceneTitle}`);
|
|
return await fetch(endpoint, {
|
|
method: 'POST',
|
|
headers: {
|
|
Accept: 'application/json',
|
|
session: sessionToken,
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify({
|
|
name: sceneTitle,
|
|
}),
|
|
})
|
|
.then(res => res.json())
|
|
.then(res => {
|
|
if (res && res.success) {
|
|
// console.log(res);
|
|
return res;
|
|
} else {
|
|
return { success : false };
|
|
}
|
|
})
|
|
.catch(e => {
|
|
return { success : false };
|
|
});
|
|
} |