@@ -12,7 +12,7 @@ use crate::database::content_folder;
1212use crate :: database:: { category, category:: CategoryOperator } ;
1313use crate :: extractors:: normalized_path:: * ;
1414use crate :: extractors:: user:: User ;
15- use crate :: state:: flash_message:: OperationStatus ;
15+ use crate :: state:: flash_message:: { OperationStatus , get_cookie } ;
1616use crate :: state:: { AppState , AppStateContext , error:: * } ;
1717
1818#[ derive( Clone , Debug , Deserialize , Serialize ) ]
@@ -123,13 +123,16 @@ pub struct CategoryShowTemplate {
123123 pub user : Option < User > ,
124124 /// Category
125125 category : category:: Model ,
126+ /// Operation status for UI confirmation (Cookie)
127+ pub flash : Option < OperationStatus > ,
126128}
127129
128130pub async fn show (
129131 State ( app_state) : State < AppState > ,
130132 user : Option < User > ,
131133 Path ( category_name) : Path < String > ,
132- ) -> Result < CategoryShowTemplate , AppStateError > {
134+ jar : CookieJar ,
135+ ) -> Result < impl IntoResponse , AppStateError > {
133136 let app_state_context = app_state. context ( ) . await ?;
134137
135138 let category: category:: Model = CategoryOperator :: new ( app_state. clone ( ) , user. clone ( ) )
@@ -144,10 +147,16 @@ pub async fn show(
144147 . await
145148 . context ( CategorySnafu ) ?;
146149
147- Ok ( CategoryShowTemplate {
148- content_folders,
149- category,
150- state : app_state_context,
151- user,
152- } )
150+ let ( jar, operation_status) = get_cookie ( jar) ;
151+
152+ Ok ( (
153+ jar,
154+ CategoryShowTemplate {
155+ content_folders,
156+ category,
157+ state : app_state_context,
158+ user,
159+ flash : operation_status,
160+ } ,
161+ ) )
153162}
0 commit comments