| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | import { buildUrl } from '../utils/urls' |
| 6 | 6 | import { useRestAPI } from './useRestAPI' |
| 7 | 7 | import type { Snippet } from '../types/Snippet' |
| 8 | 8 | import type { SnippetsExport } from '../types/schema/SnippetsExport' |
| 9 | -import type { SnippetSchema, WritableSnippetSchema } from '../types/schema/SnippetSchema' | |
| 9 | +import type { SnippetIdentifierSchema, SnippetSchema, WritableSnippetSchema } from '../types/schema/SnippetSchema' | |
| 10 | 10 | import type { RestAPI } from './useRestAPI' |
| 11 | 11 | import type { PropsWithChildren } from 'react' |
| 12 | 12 | |
| 13 | 13 | export interface SnippetsAPI { |
| @@ -40,9 +40,9 @@ | ||
| 40 | 40 | locked, |
| 41 | 41 | trashed, |
| 42 | 42 | shared_network, |
| 43 | 43 | conditionId |
| 44 | -}: Partial<Snippet>): WritableSnippetSchema => ({ | |
| 44 | +}: Partial<Snippet>): WritableSnippetSchema & Pick<SnippetIdentifierSchema, 'network'> => ({ | |
| 45 | 45 | name, |
| 46 | 46 | desc, |
| 47 | 47 | code, |
| 48 | 48 | tags, |
| @@ -72,9 +72,9 @@ | ||
| 72 | 72 | update: snippet => |
| 73 | 73 | post<SnippetSchema, WritableSnippetSchema>(snippet.id ? buildSnippetUrl(snippet) : REST_BASES.snippets, mapToSchema(snippet)) |
| 74 | 74 | .then(createSnippetObject), |
| 75 | 75 | |
| 76 | - delete: snippet => | |
| 76 | + delete: (snippet): Promise<void> => | |
| 77 | 77 | del(buildSnippetUrl(snippet)), |
| 78 | 78 | |
| 79 | 79 | restore: snippet => |
| 80 | 80 | post(buildSnippetUrl(snippet, 'restore')), |