Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mixasite committed Mar 2, 2023
1 parent 19a1f0f commit b62fdf8
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@ export default class MixaPlugin extends Plugin {

// This creates an icon in the left ribbon.
this.addRibbonIcon('paper-plane', 'Publish with Mixa', async (evt: MouseEvent) => {
if (!this.settings.subdomain) {
new Notice('Please add a valid Secret Token. You can find it in your Mixa Dashboard');
return;
}

new Notice('Publishing your site, hang tight...');
// Called when the user clicks the icon.
await syncData(this.settings, this.app.vault);
new Notice('Your site is live');
try {
await syncData(this.settings, this.app.vault);
new Notice('Changes are published to your site successfully');
} catch (error) {
new Notice(error.message || 'Failed to publish your site. Please try again, or contact support@mixa.site');
}
});

// This adds a settings tab so the user can configure various aspects of the plugin
Expand Down Expand Up @@ -125,13 +133,13 @@ class MixaSettingTab extends PluginSettingTab {
.addButton((button) => {
button.setButtonText("Publish").onClick(async (e) => {
if (!this.plugin.settings.subdomain) {
// infoDiv.textContent = 'Please add a valid Secret Token. You can find it in your Mixa Dashboard'
this.infoDiv.textContent = 'Please add a valid Secret Token. You can find it in your Mixa Dashboard'
return;
}
try {
this.infoDiv.textContent = 'We are publishing your site, hang tight';
await syncData(this.plugin.settings, this.app.vault);
this.infoDiv.textContent = 'Your site is ready';
this.infoDiv.textContent = 'Changes are published to your site successfully';
} catch (error) {
this.infoDiv.textContent = error.message || 'Failed to publish your site. Please try again, or contact support@mixa.site';
}
Expand Down

0 comments on commit b62fdf8

Please sign in to comment.