Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
r74tech committed Aug 26, 2023
1 parent 7c803c7 commit bafc94f
Showing 1 changed file with 18 additions and 38 deletions.
56 changes: 18 additions & 38 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,50 +204,30 @@ const handleEditsaveButtonClick = async () => {

// 共有ボタンを押したときの処理
const handleShareButtonClick = async () => {
const isSharePath = getCurrentShortId();
if (!isSharePath) {
const shortId = generateShortId(); // Replace this with your actual short ID generation logic
const dataToSend = {
shortid: shortId,
title: edittitleField.value,
source: editpageField.value
};
console.debug('Sending data to GAS:', dataToSend);
try {
const response = await postDataToGAS(dataToSend);
if (response.error) {
// Handle error if needed
console.error('Error sending data to GAS:', response.error);
} else {
window.location.href = `/share/${shortId}`;
}
} catch (error) {
console.error('Error sending data to GAS:', error);
}
} else {
const shortId = isSharePath;
const dataToSend = {
shortid: shortId,
title: edittitleField.value,
source: editpageField.value
};
console.debug('Sending data to GAS:', dataToSend);
try {
const response = await postDataToGAS(dataToSend);
if (response.error) {
// Handle error if needed
console.error('Error sending data to GAS:', response.error);
} else {
window.location.href = `/share/${shortId}`;
}
} catch (error) {
console.error('Error sending data to GAS:', error);
const shortId = getCurrentShortId() || generateShortId();
const dataToSend = {
shortid: shortId,
title: edittitleField.value,
source: `'${editpageField.value}` // Add a newline at the end of the source
};

console.debug('Sending data to GAS:', dataToSend);

try {
const response = await postDataToGAS(dataToSend);
if (response.error) {
console.error('Error sending data to GAS:', response.error);
} else {
window.location.href = `/share/${shortId}`;
}
} catch (error) {
console.error('Error sending data to GAS:', error);
}
};




// ローカルストレージからデータを読み込んで表示する関数
const displayLocalStorageData = (itemName = "FtmlStorage") => {
const FtmlStorageItem = localStorage.getItem(itemName);
Expand Down

0 comments on commit bafc94f

Please sign in to comment.