mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-01 13:10:44 -03:00
fix: que solo puedas ver el link o acceder a la pagina de admin si sos
admin
This commit is contained in:
@@ -27,8 +27,7 @@
|
||||
<DropdownMenuItem onclick={() => goto('/' + $sesionStore?.username)}
|
||||
>Mi Perfil</DropdownMenuItem
|
||||
>
|
||||
<!-- WIP -->
|
||||
{#if true}
|
||||
{#if $sesionStore?.isAdmin}
|
||||
<DropdownMenuItem onclick={() => goto('/admin')}>Menu Admin</DropdownMenuItem>
|
||||
{/if}
|
||||
|
||||
|
||||
9
src/routes/(privado)/admin/+page.server.ts
Normal file
9
src/routes/(privado)/admin/+page.server.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { sesionStore } from '@/stores/usuario';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
export async function load({ params }) {
|
||||
if (get(sesionStore)?.isAdmin !== true) {
|
||||
redirect(302, '/');
|
||||
}
|
||||
}
|
||||
1
src/types.d.ts
vendored
1
src/types.d.ts
vendored
@@ -37,6 +37,7 @@ export interface Sesion {
|
||||
url: string;
|
||||
displayName: string;
|
||||
username: string;
|
||||
isAdmin: boolean;
|
||||
}
|
||||
|
||||
export interface LoginDto {
|
||||
|
||||
Reference in New Issue
Block a user