@axium/notes 0.3.11 → 0.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Note.svelte CHANGED
@@ -5,6 +5,7 @@
5
5
  import { dynamicRows } from '@axium/client/attachments';
6
6
  import { AccessControlDialog, Icon, Popover } from '@axium/client/components';
7
7
  import { copy } from '@axium/client/gui';
8
+ import { toastStatus } from '@axium/client/toast';
8
9
  import type { Note } from '@axium/notes/common';
9
10
  import { download } from 'utilium/dom.js';
10
11
 
@@ -29,10 +30,13 @@
29
30
  <div
30
31
  class="menu-item"
31
32
  onclick={() =>
32
- fetchAPI('DELETE', 'notes/:id', {}, note.id).then(() => {
33
- if (!notes) goto('/notes');
34
- else notes.splice(notes.indexOf(note), 1);
35
- })}
33
+ toastStatus(
34
+ fetchAPI('DELETE', 'notes/:id', {}, note.id).then(() => {
35
+ if (!notes) goto('/notes');
36
+ else notes.splice(notes.indexOf(note), 1);
37
+ }),
38
+ text('notes.toast_deleted')
39
+ )}
36
40
  >
37
41
  <Icon i="trash" />
38
42
  <span>{text('generic.delete')}</span>
package/locales/en.json CHANGED
@@ -11,6 +11,7 @@
11
11
  "new": "New Note",
12
12
  "note_title": "Notes — {title}",
13
13
  "open_new_tab": "Open in New Tab",
14
- "share": "Share"
14
+ "share": "Share",
15
+ "toast_deleted": "Note deleted"
15
16
  }
16
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/notes",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "Notes for Axium",
6
6
  "funding": {
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { fetchAPI, text } from '@axium/client';
3
3
  import { Icon } from '@axium/client/components';
4
+ import { toast } from '@axium/client/toast';
4
5
  import { Note } from '@axium/notes/components';
5
6
 
6
7
  const { data } = $props();
@@ -18,8 +19,12 @@
18
19
  id="create-note"
19
20
  class="icon-text mobile-float-right"
20
21
  onclick={async () => {
21
- const result = await fetchAPI('PUT', 'users/:id/notes', { title: '' }, data.session.userId);
22
- notes.push(result);
22
+ try {
23
+ const result = await fetchAPI('PUT', 'users/:id/notes', { title: '' }, data.session.userId);
24
+ notes.push(result);
25
+ } catch (e) {
26
+ toast('error', e);
27
+ }
23
28
  }}
24
29
  >
25
30
  <Icon i="plus" />