Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
Add local like & history to cloud after signing in
Browse files Browse the repository at this point in the history
Closes #235
  • Loading branch information
aabounegm committed May 8, 2022
1 parent a9c9149 commit e5add34
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/features/authenticate/model/sign-in-snackbar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { snackbar } from '$lib/shared/ui/snackbar';
import { supabaseClient } from '$lib/shared/api';
import { likesStore, addCloudLike } from '$lib/features/like-episode';
import { listeningHistory, addToCloudListeningHistory } from '$lib/features/listening-history';
import { get } from 'svelte/store';

export function signInSnackbar() {
const url = new URL(window.location.href);
Expand All @@ -14,5 +17,7 @@ export function signInSnackbar() {
});
url.searchParams.delete('snackbar');
window.history.replaceState(null, '', url.toString());
get(likesStore).forEach(addCloudLike);
get(listeningHistory).forEach(addToCloudListeningHistory);
}
}
1 change: 1 addition & 0 deletions src/lib/features/like-episode/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as LikeButton } from './ui/like-button.svelte';
export { likesStore, toggleLike } from './model/like';
export { populateLikes } from './model/populate-likes';
export { addCloudLike } from './api/favourites-table';
1 change: 1 addition & 0 deletions src/lib/features/listening-history/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { addToListeningHistory, listeningHistory } from './model/store';
export { populateListeningHistory } from './model/populate-listening-history';
export { addToCloudListeningHistory } from './api/history-table';

0 comments on commit e5add34

Please sign in to comment.