Changeset e882b92 for chapterx-frontend/src/store
- Timestamp:
- 08/24/26 20:57:09 (13 days ago)
- Branches:
- main
- Parents:
- a6e33d1
- Location:
- chapterx-frontend/src/store
- Files:
-
- 2 edited
-
notificationStore.ts (modified) (3 diffs)
-
storyStore.ts (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
chapterx-frontend/src/store/notificationStore.ts
ra6e33d1 re882b92 17 17 notifications: Notification[] 18 18 fetchUserNotifications: (userId: number) => Promise<void> 19 addNotification: (n: { recipientUserId: number; type: string; content: string; link?: string }) => Promise<void>19 addNotification: (n: { userId: number; contentType: string; content: string; storyId?: number; link?: string }) => Promise<void> 20 20 markAllRead: () => Promise<void> 21 21 markRead: (id: number) => Promise<void> … … 33 33 notification_id: n.id, 34 34 user_id: userId, 35 type: n. type ?? 'info',36 title: n. type ?? 'Notification',35 type: n.contentType ?? 'info', 36 title: n.contentType ?? 'Notification', 37 37 message: n.content, 38 38 link: n.link, … … 46 46 }, 47 47 48 addNotification: async ({ recipientUserId, type, content, link }) => {48 addNotification: async ({ userId, contentType, content, storyId, link }) => { 49 49 try { 50 50 await axios.post(`${API}/notifications`, { 51 51 content, 52 recipientUserId, 53 type, 52 contentType, 53 userId, 54 storyId, 54 55 link, 55 56 }, { headers: getAuthHeaders() }) -
chapterx-frontend/src/store/storyStore.ts
ra6e33d1 re882b92 144 144 cover_image: s.image ?? undefined, 145 145 mature_content: s.matureContent, 146 status: 'published'as StoryStatus,146 status: (s.status ?? 'draft') as StoryStatus, 147 147 author_username: s.writer?.user?.username ?? '', 148 148 created_at: s.createdAt, … … 193 193 name: c.name ?? c.username ?? '', 194 194 story_title: '', 195 role: 'editor'as any,196 permission_level: 3as any,195 role: c.role as any, 196 permission_level: (c.permissionLevel ?? 3) as any, 197 197 joined_at: c.createdAt, 198 198 })) … … 246 246 image: imageUrl, 247 247 content: partial.content ?? story.content, 248 status: partial.status ?? story.status, 248 249 }, { headers: getAuthHeaders() }) 249 250 } catch { … … 266 267 }, 267 268 268 updateStoryStatus: (id, status) => 269 updateStoryStatus: (id, status) => { 269 270 set(state => ({ 270 271 stories: state.stories.map(s => 271 272 s.story_id === id ? { ...s, status, updated_at: new Date().toISOString() } : s 272 273 ), 273 })), 274 })) 275 get().updateStory(id, { status }) 276 }, 274 277 275 278 addChapter: async (chapter) => { … … 407 410 storyId: collab.story_id, 408 411 role: collab.role, 412 permissionLevel: collab.permission_level, 409 413 }, { headers: getAuthHeaders() }) 410 414 } catch { … … 445 449 original_text: s.originalText, 446 450 suggested_text: s.suggestedText, 447 suggestion_type: (s.suggestionTypes?.[0] ?? 'style') as SuggestionType, 451 suggestion_type: (s.suggestionType ?? 'style') as SuggestionType, 452 explanation: s.explanation ?? '', 448 453 accepted: s.accepted === true ? true : s.accepted === false ? false : null, 454 created_at: s.createdAt ?? new Date().toISOString(), 449 455 applied_at: s.appliedAt ?? undefined, 450 456 })) … … 506 512 originalText: suggestion.original_text, 507 513 suggestedText: suggestion.suggested_text, 514 suggestionType: suggestion.suggestion_type, 508 515 storyId: suggestion.chapter_id, 509 516 }, { headers: getAuthHeaders() })
Note:
See TracChangeset
for help on using the changeset viewer.
