<commit_before>(ns braid.core.client.gateway.forms.join-group.events
  (:require
   [braid.core.client.gateway.helpers :as helpers :refer [get-url-group-id]]
   [braid.core.client.state :refer [reg-event-fx]]
   [clojure.string :as string]
   [re-frame.core :refer [dispatch]]))

(reg-event-fx
  ::initialize
  (fn [{state :db}]
    {:dispatch-n [[:braid.core.client.gateway.forms.user-auth.events/initialize :log-in]]}))

(reg-event-fx
  ::remote-join-group
  (fn [{state :db} _]
    {:edn-xhr {:method :put
               :uri (str "/groups/" (get-url-group-id) "/join")
               :headers {"x-csrf-token" (state :csrf-token)}
               :on-complete
               (fn [response]
                 (set! js/window.location (str "/groups/" (get-url-group-id))))
               :on-error
               (fn [error]
                 (when-let [k (get-in error [:response :error])]
                   (dispatch [:braid.notices/display! [(keyword "join-group-error" (get-url-group-id)) k :error]])))}}))<commit_msg>Fix out-of-date URL<commit_after>(ns braid.core.client.gateway.forms.join-group.events
  (:require
   [braid.core.client.gateway.helpers :as helpers :refer [get-url-group-id]]
   [braid.core.client.state :refer [reg-event-fx]]
   [clojure.string :as string]
   [re-frame.core :refer [dispatch]]))

(reg-event-fx
  ::initialize
  (fn [{state :db}]
    {:dispatch-n [[:braid.core.client.gateway.forms.user-auth.events/initialize :log-in]]}))

(reg-event-fx
  ::remote-join-group
  (fn [{state :db} _]
    {:edn-xhr {:method :put
               :uri (str "/groups/" (get-url-group-id) "/join")
               :headers {"x-csrf-token" (state :csrf-token)}
               :on-complete
               (fn [response]
                 (set! js/window.location (str "/groups/" (get-url-group-id) "/inbox")))
               :on-error
               (fn [error]
                 (when-let [k (get-in error [:response :error])]
                   (dispatch [:braid.notices/display! [(keyword "join-group-error" (get-url-group-id)) k :error]])))}}))
{'fraction_non_alphanumeric': 0.18911035488575595, 'fraction_numerical': 0.0, 'mean_word_length': 2.314009661835749, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7318491', 'n_tokens_mistral': 720, 'n_tokens_neox': 719, 'n_words': 134}