- Processing
+ let canisters = authenticated_canisters();
+ let upload_uid = upload_action.value();
+ let publish_action = create_action(move |(canisters, uid): &(Canisters, String)| {
+ let canisters = canisters.clone();
+ let hashtags = hashtags.clone();
+ let description = description.clone();
+ let uid = uid.clone();
+ async move {
+ let user = canisters.authenticated_user();
+ let res = user
+ .add_post_v_2(PostDetailsFromFrontend {
+ hashtags,
+ description,
+ video_uid: uid,
+ creator_consent_for_inclusion_in_hot_or_not: params.enable_hot_or_not,
+ is_nsfw: params.is_nsfw,
+ })
+ .await;
+ let res = try_or_redirect!(res);
+ match res {
+ Result_::Ok(_) => (),
+ Result_::Err(e) => {
+ failure_redirect(e);
+ return;
+ }
+ }
+ publishing.set(false);
}
- };
+ });
view! {
@@ -210,56 +250,26 @@ pub fn VideoUploader(params: UploadParams) -> impl IntoView {
-
-
Uploading
- }
- }>
- {move || {
- upload_action
- .get()
- .map(|_| {
- view! {
-
-
Uploaded
- }
- })
- }}
-
-
+
+
+
-
-
- {move || {
- process_action
- .get()
- .map(|_| {
- view! {
-
-
- Processed
-
- }
- })
- }}
+
+
+ {move || {
+ let uid = upload_uid().flatten()?;
+ let canisters = try_or_redirect_opt!(canisters.get() ?);
+ publish_action.dispatch((canisters, uid));
+ Some(())
+ }}
-