VRFS-5691 - fix both the jamtrack flow and the inability to sign out
This commit is contained in:
parent
4ffc0d9b3b
commit
4eac68b645
|
|
@ -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.
|
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)
|
||||||
|
|
|
||||||
|
|
@ -64,12 +64,18 @@ const JKRegistrationForm = ({ hasLabel, jamTrack, jamTrackArtistName }) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('currentUser', currentUser);
|
||||||
|
console.log('jamTrack', jamTrack);
|
||||||
|
console.log('jamTrackArtistName', jamTrackArtistName);
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
if(jamTrack){
|
if(jamTrack){
|
||||||
|
console.log('adding jamtrack to cart');
|
||||||
addJamTrackToCart();
|
addJamTrackToCart();
|
||||||
}else if(jamTrackArtistName){
|
}else if(jamTrackArtistName){
|
||||||
|
console.log('redirecting to jamtracks artist landing');
|
||||||
history.push(`/jamtracks?artist=${jamTrackArtistName}`);
|
history.push(`/jamtracks?artist=${jamTrackArtistName}`);
|
||||||
}else{
|
}else{
|
||||||
|
console.log('redirecting to downloads');
|
||||||
history.push('/public/downloads');
|
history.push('/public/downloads');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,9 @@ const Registration = () => {
|
||||||
try {
|
try {
|
||||||
const response = await getJamTrackBySlug({ slug });
|
const response = await getJamTrackBySlug({ slug });
|
||||||
const jamTrack = await response.json();
|
const jamTrack = await response.json();
|
||||||
|
console.log('jamTrack', jamTrack);
|
||||||
setJamTrack(jamTrack);
|
setJamTrack(jamTrack);
|
||||||
|
setJamTrackArtistName(jamTrack.original_artist);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ const awesome9 = '/img/landing/jamtracks/Top 10 Image - Number 9.webp';
|
||||||
const BodyComponent = ({
|
const BodyComponent = ({
|
||||||
id = "1",
|
id = "1",
|
||||||
plan_code = "jamtrack-acdc-backinblack",
|
plan_code = "jamtrack-acdc-backinblack",
|
||||||
slug = "ac-dc-back-in-black",
|
slug = "acdc-back-in-black",
|
||||||
artist = "AC/DC (defaulted)",
|
artist = "AC/DC (defaulted)",
|
||||||
song = "Back in Black (defaulted)",
|
song = "Back in Black (defaulted)",
|
||||||
provided_jam_track = null
|
provided_jam_track = null
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,24 @@ const ProfileDropdown = () => {
|
||||||
|
|
||||||
const handleLogout = async event => {
|
const handleLogout = async event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
const cookieDomain = `.${process.env.REACT_APP_ORIGIN}`;
|
||||||
|
console.log('handleLogout: cookie: ', cookieDomain);
|
||||||
removeCookie('remember_token', {
|
removeCookie('remember_token', {
|
||||||
domain: `.${process.env.REACT_APP_ORIGIN}`
|
domain: cookieDomain,
|
||||||
|
path: '/'
|
||||||
});
|
});
|
||||||
setCurrentUser(null);
|
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();
|
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";
|
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 (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
object @jam_track
|
object @jam_track
|
||||||
|
|
||||||
attributes :id, :name
|
attributes :id, :name, :original_artist
|
||||||
Loading…
Reference in New Issue