feat: make system components require the system classes

This commit is contained in:
Spectralitree 2021-12-12 07:45:42 +01:00
parent be1a2423f9
commit ed257afcc6
5 changed files with 9 additions and 7 deletions

View File

@ -2,9 +2,8 @@
import { Modal, CardHeader, CardTitle, Image } from 'sveltestrap';
import FaUserCircle from 'svelte-icons/fa/FaUserCircle.svelte'
import default_avatar from '../assets/default_avatar.png';
import type Sys from '../api/system';
export let item: Sys;
export let item: any;
let avatarOpen = false;
const toggleAvatarModal = () => (avatarOpen = !avatarOpen);

View File

@ -2,8 +2,9 @@
import { Row, Col, Modal, Image, Button } from 'sveltestrap';
import moment from 'moment';
import { toHTML } from 'discord-markdown';
import type Sys from '../../api/system';
export let user;
export let user: Sys;
export let editMode: boolean;
let htmlDescription: string;

View File

@ -3,8 +3,9 @@
import CardsHeader from '../CardsHeader.svelte';
import SystemBody from './Body.svelte';
import SystemPrivacy from './Privacy.svelte';
import type Sys from '../../api/system';
export let user;
export let user: Sys;
export let isPublic = true;
let editMode = false;

View File

@ -1,8 +1,9 @@
<script lang="ts">
import { Card, CardHeader, CardBody, CardTitle, Row, Col, Button } from 'sveltestrap';
import FaUserLock from 'svelte-icons/fa/FaUserLock.svelte'
import type Sys from '../../api/system';
export let user;
export let user: Sys;
let editMode = false;
</script>

View File

@ -5,7 +5,7 @@
import System from '../lib/system/Main.svelte';
import PKAPI from '../api';
import type Sys from '../api/system';
import Sys from '../api/system';
let isPublic = false;
@ -24,7 +24,7 @@
});
// if there is no cached user, get the user from localstorage
let user = current ? current : JSON.parse(localStorage.getItem("pk-user"));
let user = new Sys(current ? current : JSON.parse(localStorage.getItem("pk-user")));
// since the user in localstorage can be outdated, fetch the user from the api again
if (!current) {
login(localStorage.getItem("pk-token"));