@@ -19,8 +19,10 @@ export type BookcaseEdgeWithPopularity = BookcaseEdge & {
1919export const bookcase = defineStore ( "bookcase" , ( ) => {
2020 const route = useRoute ( ) ;
2121
22- const { bookcase : bookcaseEvents , userBookcase : userBookcaseEvents } =
23- inject ( socketInjectionKey ) ! ;
22+ const {
23+ privateBookcase : privateBookcaseEvents ,
24+ userBookcase : userBookcaseEvents ,
25+ } = inject ( socketInjectionKey ) ! ;
2426
2527 const loadedSprites = ref < { [ key : string ] : string } > ( { } ) ,
2628 isPrivateBookcase = ref ( false ) ,
@@ -46,16 +48,16 @@ export const bookcase = defineStore("bookcase", () => {
4648 ? 0
4749 : collection ( ) . popularIssuesInCollection ?. [ issue . issuecode ] || 0 ,
4850 } ) ) ) ||
49- null ,
51+ null
5052 ) ,
5153 popularIssuesInCollectionWithoutEdge = computed ( ( ) =>
5254 bookcaseWithPopularities . value
5355 ?. filter (
54- ( { edgeId, popularity } ) => ! edgeId && popularity && popularity > 0 ,
56+ ( { edgeId, popularity } ) => ! edgeId && popularity && popularity > 0
5557 )
5658 . sort ( ( { popularity : popularity1 } , { popularity : popularity2 } ) =>
57- popularity2 && popularity1 ? popularity2 - popularity1 : 0 ,
58- ) ,
59+ popularity2 && popularity1 ? popularity2 - popularity1 : 0
60+ )
5961 ) ,
6062 addLoadedSprite = ( {
6163 spritePath,
@@ -71,8 +73,8 @@ export const bookcase = defineStore("bookcase", () => {
7173 } ,
7274 loadBookcase = async ( ) => {
7375 if ( ! bookcaseContents . value ) {
74- const response = await bookcaseEvents . getBookcase (
75- collection ( ) . user ! . username ,
76+ const response = await userBookcaseEvents . getBookcase (
77+ collection ( ) . user ! . username
7678 ) ;
7779 if ( "error" in response ) {
7880 switch ( response . error ) {
@@ -98,8 +100,8 @@ export const bookcase = defineStore("bookcase", () => {
98100 } ,
99101 loadBookcaseOptions = async ( ) => {
100102 if ( ! bookcaseOptions . value ) {
101- const response = await bookcaseEvents . getBookcaseOptions (
102- bookcaseUsername . value ! ,
103+ const response = await userBookcaseEvents . getBookcaseOptions (
104+ bookcaseUsername . value !
103105 ) ;
104106 if ( "error" in response ) {
105107 console . error ( response . error ) ;
@@ -109,13 +111,14 @@ export const bookcase = defineStore("bookcase", () => {
109111 }
110112 } ,
111113 updateBookcaseOptions = async ( ) => {
112- await userBookcaseEvents . setBookcaseOptions ( bookcaseOptions . value ! ) ;
114+ await privateBookcaseEvents . setBookcaseOptions ( bookcaseOptions . value ! ) ;
113115 } ,
114116 loadBookcaseOrder = async ( ) => {
115117 if ( ! bookcaseOrder . value ) {
116- const response = await bookcaseEvents . getBookcaseOrder (
117- bookcaseUsername . value ! ,
118+ const response = await userBookcaseEvents . getBookcaseOrder (
119+ bookcaseUsername . value !
118120 ) ;
121+ debugger ;
119122 if ( "error" in response ) {
120123 console . error ( response . error ) ;
121124 } else {
@@ -124,8 +127,7 @@ export const bookcase = defineStore("bookcase", () => {
124127 }
125128 } ,
126129 updateBookcaseOrder = async ( ) => {
127- // TODO implement
128- // await userBookcaseEvents.setBookcaseOrder(bookcaseOrder.value!);
130+ await privateBookcaseEvents . setBookcaseOrder ( bookcaseOrder . value ! ) ;
129131 } ;
130132
131133 return {
0 commit comments