mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-01 13:10:44 -03:00
bun run format
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
# Package Managers
|
# Package Managers
|
||||||
|
src/lib/components/ui/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
yarn.lock
|
yarn.lock
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
{
|
{
|
||||||
"useTabs": true,
|
"useTabs": true,
|
||||||
"singleQuote": true,
|
"singleQuote": false,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"printWidth": 100,
|
"printWidth": 100,
|
||||||
"plugins": [
|
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
|
||||||
"prettier-plugin-svelte",
|
|
||||||
"prettier-plugin-tailwindcss"
|
|
||||||
],
|
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"files": "*.svelte",
|
"files": "*.svelte",
|
||||||
|
|||||||
@@ -16,7 +16,10 @@
|
|||||||
let {
|
let {
|
||||||
post,
|
post,
|
||||||
variant = 'icon-lg'
|
variant = 'icon-lg'
|
||||||
}: { post: Omit<Partial<Post>, 'authorId'> & { authorId: string; id: string }; variant?: 'icon-lg' | 'default' | 'sm' | 'lg' | 'icon' | 'icon-sm' } = $props();
|
}: {
|
||||||
|
post: Omit<Partial<Post>, 'authorId'> & { authorId: string; id: string };
|
||||||
|
variant?: 'icon-lg' | 'default' | 'sm' | 'lg' | 'icon' | 'icon-sm';
|
||||||
|
} = $props();
|
||||||
|
|
||||||
let seguido: boolean | null = $state(null);
|
let seguido: boolean | null = $state(null);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { apiBase } from "@/stores/url";
|
import { apiBase } from '@/stores/url';
|
||||||
import { get } from "svelte/store";
|
import { get } from 'svelte/store';
|
||||||
|
|
||||||
export async function checkEmail(email: string) {
|
export async function checkEmail(email: string) {
|
||||||
try {
|
try {
|
||||||
const req = await fetch(`${get(apiBase)}/api/users/check-email/${email}`, {
|
const req = await fetch(`${get(apiBase)}/api/users/check-email/${email}`, {
|
||||||
method: "GET"
|
method: 'GET'
|
||||||
});
|
});
|
||||||
if (req.ok){
|
if (req.ok) {
|
||||||
return (await req.json()).available;
|
return (await req.json()).available;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { apiBase } from "@/stores/url";
|
import { apiBase } from '@/stores/url';
|
||||||
import { get } from "svelte/store";
|
import { get } from 'svelte/store';
|
||||||
|
|
||||||
export async function checkUsername(username: string) {
|
export async function checkUsername(username: string) {
|
||||||
try {
|
try {
|
||||||
const req = await fetch(`${get(apiBase)}/api/users/check-username/${username}`, {
|
const req = await fetch(`${get(apiBase)}/api/users/check-username/${username}`, {
|
||||||
method: "GET"
|
method: 'GET'
|
||||||
});
|
});
|
||||||
if (req.ok){
|
if (req.ok) {
|
||||||
return (await req.json()).available;
|
return (await req.json()).available;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { apiBase } from "@/stores/url";
|
import { apiBase } from '@/stores/url';
|
||||||
import { sesionStore } from "@/stores/usuario";
|
import { sesionStore } from '@/stores/usuario';
|
||||||
import { get } from "svelte/store";
|
import { get } from 'svelte/store';
|
||||||
import type { Post } from '../../types';
|
import type { Post } from '../../types';
|
||||||
import { PAGE_SIZE } from '../stores/posts';
|
import { PAGE_SIZE } from '../stores/posts';
|
||||||
|
|
||||||
@@ -10,10 +10,9 @@ export async function getPosts(page: number = 1): Promise<Post[]> {
|
|||||||
const headers: HeadersInit = {};
|
const headers: HeadersInit = {};
|
||||||
if (token) headers.Authorization = `Bearer ${token}`;
|
if (token) headers.Authorization = `Bearer ${token}`;
|
||||||
|
|
||||||
const res = await fetch(
|
const res = await fetch(`${get(apiBase)}/timeline?page=${page}&pageSize=${PAGE_SIZE}`, {
|
||||||
`${get(apiBase)}/timeline?page=${page}&pageSize=${PAGE_SIZE}`,
|
headers
|
||||||
{ headers }
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if (!res.ok) throw new Error('Error cargando posts');
|
if (!res.ok) throw new Error('Error cargando posts');
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { sesionStore } from '@/stores/usuario';
|
|||||||
import type { Post } from '../../types';
|
import type { Post } from '../../types';
|
||||||
|
|
||||||
export async function likePost(post: Post) {
|
export async function likePost(post: Post) {
|
||||||
let method = post.isLiked ? "DELETE" : "POST";
|
let method = post.isLiked ? 'DELETE' : 'POST';
|
||||||
try {
|
try {
|
||||||
const req = await fetch(get(apiBase) + `/api/posts/${post.id}/like`, {
|
const req = await fetch(get(apiBase) + `/api/posts/${post.id}/like`, {
|
||||||
method: method,
|
method: method,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export async function loadMorePosts() {
|
|||||||
if (newPosts.length < PAGE_SIZE) {
|
if (newPosts.length < PAGE_SIZE) {
|
||||||
finished = true;
|
finished = true;
|
||||||
} else {
|
} else {
|
||||||
page.update(p => p + 1);
|
page.update((p) => p + 1);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
loadingPosts.set(false);
|
loadingPosts.set(false);
|
||||||
|
|||||||
@@ -13,13 +13,16 @@ export async function obtenerSeguidoresPorUsuario(
|
|||||||
const fetchFunc = fetch2 || fetch;
|
const fetchFunc = fetch2 || fetch;
|
||||||
const skip = (page - 1) * limit;
|
const skip = (page - 1) * limit;
|
||||||
|
|
||||||
const response = await fetchFunc(`${get(apiBase)}/api/users/${id}/followers?skip=${skip}&limit=${limit}`, {
|
const response = await fetchFunc(
|
||||||
|
`${get(apiBase)}/api/users/${id}/followers?skip=${skip}&limit=${limit}`,
|
||||||
|
{
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
|
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -13,13 +13,16 @@ export async function obtenerSeguidosPorUsuario(
|
|||||||
const fetchFunc = fetch2 || fetch;
|
const fetchFunc = fetch2 || fetch;
|
||||||
const skip = (page - 1) * limit;
|
const skip = (page - 1) * limit;
|
||||||
|
|
||||||
const response = await fetchFunc(`${get(apiBase)}/api/users/${id}/following?skip=${skip}&limit=${limit}`, {
|
const response = await fetchFunc(
|
||||||
|
`${get(apiBase)}/api/users/${id}/following?skip=${skip}&limit=${limit}`,
|
||||||
|
{
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
|
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { addPost } from "@/stores/posts";
|
import { addPost } from '@/stores/posts';
|
||||||
import { apiBase } from "@/stores/url";
|
import { apiBase } from '@/stores/url';
|
||||||
import { sesionStore } from "@/stores/usuario";
|
import { sesionStore } from '@/stores/usuario';
|
||||||
import { get } from "svelte/store";
|
import { get } from 'svelte/store';
|
||||||
|
|
||||||
export async function publicarPost(formData: FormData){
|
export async function publicarPost(formData: FormData) {
|
||||||
try{
|
try {
|
||||||
const req = fetch(get(apiBase) + '/api/posts', {
|
const req = fetch(get(apiBase) + '/api/posts', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
//credentials: 'include',
|
//credentials: 'include',
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
export async function updateImagenDePerfil(){
|
export async function updateImagenDePerfil() {
|
||||||
try{
|
try {
|
||||||
|
} catch {}
|
||||||
}catch{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { sesionStore } from '@/stores/usuario';
|
|||||||
export async function updatePost(post: Post, callbackfn: Function, message: string) {
|
export async function updatePost(post: Post, callbackfn: Function, message: string) {
|
||||||
try {
|
try {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("content", post.content);
|
formData.append('content', post.content);
|
||||||
formData.append("image", post.image||"");
|
formData.append('image', post.image || '');
|
||||||
|
|
||||||
const req = await fetch(get(apiBase) + `/api/posts/${post.id}`, {
|
const req = await fetch(get(apiBase) + `/api/posts/${post.id}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
|
|||||||
@@ -19,21 +19,14 @@ export const addPost = (post: Post) => {
|
|||||||
posts.update((current) => [post, ...current]);
|
posts.update((current) => [post, ...current]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updatePostStore = (
|
export const updatePostStore = (postId: string, updatedData: Partial<Post>) => {
|
||||||
postId: string,
|
|
||||||
updatedData: Partial<Post>
|
|
||||||
) => {
|
|
||||||
posts.update((current) =>
|
posts.update((current) =>
|
||||||
current.map((post) =>
|
current.map((post) => (post.id === postId ? { ...post, ...updatedData } : post))
|
||||||
post.id === postId ? { ...post, ...updatedData } : post
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const removePost = (postId: string) => {
|
export const removePost = (postId: string) => {
|
||||||
posts.update((current) =>
|
posts.update((current) => current.filter((post) => post.id !== postId));
|
||||||
current.filter((post) => post.id !== postId)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const resetPosts = () => {
|
export const resetPosts = () => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { obtenerUsuarioPorUsername } from '@/hooks/obtenerUsuario.js';
|
import { obtenerUsuarioPorUsername } from '@/hooks/obtenerUsuario.js';
|
||||||
import type {UserResponseDto } from '../../types.js';
|
import type { UserResponseDto } from '../../types.js';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import type { PageLoad } from './$types';
|
import type { PageLoad } from './$types';
|
||||||
import { obtenerSeguidosPorUsuario } from '@/hooks/obtenerSeguidosPorUsuario.js';
|
import { obtenerSeguidosPorUsuario } from '@/hooks/obtenerSeguidosPorUsuario.js';
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex min-h-fit w-full items-center justify-center p-6 md:p-10">
|
<div class="flex min-h-fit w-full items-center justify-center p-6 md:p-10">
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ export const load: PageLoad = async ({ params, fetch }) => {
|
|||||||
usuario,
|
usuario,
|
||||||
seguidores: seguidoresResponse?.response || []
|
seguidores: seguidoresResponse?.response || []
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex min-h-fit w-full items-center justify-center p-6 md:p-10">
|
<div class="flex min-h-fit w-full items-center justify-center p-6 md:p-10">
|
||||||
|
|||||||
Reference in New Issue
Block a user