feat: unauthenticated tab
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user