Skip to content

Commit

Permalink
Fix save button
Browse files Browse the repository at this point in the history
  • Loading branch information
grulex committed Oct 27, 2023
1 parent 64c9ad7 commit d536d86
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
19 changes: 8 additions & 11 deletions src/routes/wishlists/[wishlist_id]/edit/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
let mainButton = false;
$: if (mainButton) {
window.Telegram.WebApp.MainButton.setParams({
mainButton.setParams({
text: $_('app.save'),
});
if (window.mainButtonFunction) {
mainButton.offClick(window.mainButtonFunction);
}
mainButton.onClick(submitForm);
window.mainButtonFunction = submitForm;
mainButton.show();
}
let loading = false;
Expand Down Expand Up @@ -46,16 +53,6 @@
if (isTgInitialized) {
const tgApp = window.Telegram.WebApp;
mainButton = tgApp.MainButton;
mainButton.setParams({
text: $_('app.save'),
});
if (window.mainButtonFunction) {
mainButton.offClick(window.mainButtonFunction);
}
mainButton.onClick(submitForm);
window.mainButtonFunction = submitForm;
mainButton.show();
const backButton = tgApp.BackButton;
if (window.backButtonFunction) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
let mainButton = false;
$: if (mainButton) {
window.Telegram.WebApp.MainButton.setParams({
mainButton.setParams({
text: $_('app.save'),
});
if (window.mainButtonFunction) {
mainButton.offClick(window.mainButtonFunction);
}
mainButton.onClick(submitForm);
window.mainButtonFunction = submitForm;
mainButton.show();
}
let loading = false;
Expand Down Expand Up @@ -75,16 +82,6 @@
if (isTgInitialized) {
const tgApp = window.Telegram.WebApp;
mainButton = tgApp.MainButton;
mainButton.setParams({
text: $_('app.save'),
});
if (window.mainButtonFunction) {
mainButton.offClick(window.mainButtonFunction);
}
mainButton.onClick(submitForm);
window.mainButtonFunction = submitForm;
mainButton.show();
const backButton = tgApp.BackButton;
if (window.backButtonFunction) {
Expand Down

0 comments on commit d536d86

Please sign in to comment.