unpublished fix

This commit is contained in:
nomadics9 2024-05-12 08:22:20 +03:00
parent e8f064fe3b
commit 9257889989
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import UserLink from "$lib/components/UserLink.svelte"; import UserLink from "$lib/components/UserLink.svelte";
import type { PageData } from "./$types"; import type { PageData } from "./$types";
import { userData, auth } from "$lib/firebase"; import { userData, auth, user } from "$lib/firebase";
import { import {
signInWithPopup, signInWithPopup,
GoogleAuthProvider, GoogleAuthProvider,
@ -72,7 +72,7 @@
</ul> </ul>
<br /> <br />
</div> </div>
{#if $userData?.username == $userData?.username} {#if $userData?.username == data.username}
<div class=" top-0 right-0 absolute"> <div class=" top-0 right-0 absolute">
<a href="/{$userData?.username}/edit"> <a href="/{$userData?.username}/edit">
<button class="btn btn-ghost text-xs btn-xs mx-3 my-3" <button class="btn btn-ghost text-xs btn-xs mx-3 my-3"

View file

@ -1,6 +1,6 @@
import { collection, getDocs, limit, query, where } from 'firebase/firestore'; import { collection, getDocs, limit, query, where } from 'firebase/firestore';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
import { db } from '$lib/firebase'; import { db, userData } from '$lib/firebase';
import { error } from '@sveltejs/kit'; import { error } from '@sveltejs/kit';
export const load = (async ({ params }) => { export const load = (async ({ params }) => {
@ -20,7 +20,7 @@ export const load = (async ({ params }) => {
throw error(404, "that user does not exists") throw error(404, "that user does not exists")
} }
if (!data.published && data.username != data.username) { if (!data.published) {
throw error(403, `The Profile of @${data.username} is not public!`) throw error(403, `The Profile of @${data.username} is not public!`)
} }