feat: unauthenticated tab

This commit is contained in:
2025-11-05 10:58:34 +01:00
parent 8180e0b375
commit e8db8d1654
15 changed files with 229 additions and 58 deletions
+12 -2
View File
@@ -15,6 +15,7 @@ import firebase, {
} from "../config/firebase";
import { getUserPreferredArtistName } from "../utils/artistName";
import { getLikeFieldPath, LIKE_TARGET } from "../utils/likes";
import { ensureAuthenticated } from "../utils/authRedirect";
const SONG_LIKES_FIELD = getLikeFieldPath(LIKE_TARGET.SONG);
const PLAYBACK_LIKES_FIELD = getLikeFieldPath(LIKE_TARGET.PLAYBACK);
@@ -191,6 +192,9 @@ export default ({ children }) => {
};
const createNewProject = async ({ hasLyrics = false } = {}) => {
if (!ensureAuthenticated(currentUID)) {
return null;
}
const existingProjectsCount = Array.isArray(userProjects)
? userProjects.length
: 0;
@@ -225,7 +229,10 @@ export default ({ children }) => {
};
const followUser = async (userId) => {
try {
if (currentUID && userId) {
if (!ensureAuthenticated(currentUID)) {
return;
}
if (userId) {
await usersRef.doc(userId).set(
{
followedBy: arrayUnion(currentUID),
@@ -243,7 +250,10 @@ export default ({ children }) => {
const unfollowUser = async (userId) => {
try {
if (currentUID && userId) {
if (!ensureAuthenticated(currentUID)) {
return;
}
if (userId) {
await usersRef.doc(userId).set(
{
followedBy: arrayRemove(currentUID),