VRFS-5691 - fix both the jamtrack flow and the inability to sign out

This commit is contained in:
Seth Call 2025-10-12 11:55:50 -05:00
parent 4ffc0d9b3b
commit 4eac68b645
6 changed files with 39 additions and 3 deletions

View File

@ -38,3 +38,19 @@ npm run start
This will open it in a borwser window at http://beta.jamkazam.local:3000. Of course for it to work you also need Rails (web) app and websocket app (websocket-gateway) running.
## Working with JamTracks
if you have the latest from develop, you can go:
```
cd cicd
npm install
./export_personal_jamtracks.sh
./generate.js
open http://beta.jamkazam.local:4000/backing-tracks/ac-dc/back-in-black.html
```
You can also do none of the above, and go straight to:
http://beta.jamkazam.local:4000/public/backing-tracks/ac-dc/back-in-black
I tried to make it so the SPA has 'secret routes' to these pages, which is convenient for us dev & testing
but also tried to make it convenient to run the cicd approach of actually generating separate pages for each landing page (which is what those 5 steps cover)

View File

@ -64,12 +64,18 @@ const JKRegistrationForm = ({ hasLabel, jamTrack, jamTrackArtistName }) => {
}
}
console.log('currentUser', currentUser);
console.log('jamTrack', jamTrack);
console.log('jamTrackArtistName', jamTrackArtistName);
if (currentUser) {
if(jamTrack){
console.log('adding jamtrack to cart');
addJamTrackToCart();
}else if(jamTrackArtistName){
console.log('redirecting to jamtracks artist landing');
history.push(`/jamtracks?artist=${jamTrackArtistName}`);
}else{
console.log('redirecting to downloads');
history.push('/public/downloads');
}
}

View File

@ -33,7 +33,9 @@ const Registration = () => {
try {
const response = await getJamTrackBySlug({ slug });
const jamTrack = await response.json();
console.log('jamTrack', jamTrack);
setJamTrack(jamTrack);
setJamTrackArtistName(jamTrack.original_artist);
setLoading(false);
} catch (error) {
console.error(error);

View File

@ -23,7 +23,7 @@ const awesome9 = '/img/landing/jamtracks/Top 10 Image - Number 9.webp';
const BodyComponent = ({
id = "1",
plan_code = "jamtrack-acdc-backinblack",
slug = "ac-dc-back-in-black",
slug = "acdc-back-in-black",
artist = "AC/DC (defaulted)",
song = "Back in Black (defaulted)",
provided_jam_track = null

View File

@ -23,12 +23,24 @@ const ProfileDropdown = () => {
const handleLogout = async event => {
event.preventDefault();
const cookieDomain = `.${process.env.REACT_APP_ORIGIN}`;
console.log('handleLogout: cookie: ', cookieDomain);
removeCookie('remember_token', {
domain: `.${process.env.REACT_APP_ORIGIN}`
domain: cookieDomain,
path: '/'
});
setCurrentUser(null);
// This will cause the server to remove the cookie TOO (overkill),
// but this code has a side effect because something, somewhere,
// client-side history pushes to /auth/login because of this function.
// ...
await logout();
// But I don't want to count on that side effect (defensive against future changes), so I force a page location hit here
window.location.href = "/auth/login";
// And here's the final bit; force a full page refresh ANYWAY.
// This is the only way we seem to really clear
// 'login state' cleanly at this point
window.location.reload();
};
return (

View File

@ -1,3 +1,3 @@
object @jam_track
attributes :id, :name
attributes :id, :name, :original_artist