feat: make system components require the system classes
This commit is contained in:
parent
be1a2423f9
commit
ed257afcc6
@ -2,9 +2,8 @@
|
|||||||
import { Modal, CardHeader, CardTitle, Image } from 'sveltestrap';
|
import { Modal, CardHeader, CardTitle, Image } from 'sveltestrap';
|
||||||
import FaUserCircle from 'svelte-icons/fa/FaUserCircle.svelte'
|
import FaUserCircle from 'svelte-icons/fa/FaUserCircle.svelte'
|
||||||
import default_avatar from '../assets/default_avatar.png';
|
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;
|
let avatarOpen = false;
|
||||||
const toggleAvatarModal = () => (avatarOpen = !avatarOpen);
|
const toggleAvatarModal = () => (avatarOpen = !avatarOpen);
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
import { Row, Col, Modal, Image, Button } from 'sveltestrap';
|
import { Row, Col, Modal, Image, Button } from 'sveltestrap';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { toHTML } from 'discord-markdown';
|
import { toHTML } from 'discord-markdown';
|
||||||
|
import type Sys from '../../api/system';
|
||||||
|
|
||||||
export let user;
|
export let user: Sys;
|
||||||
export let editMode: boolean;
|
export let editMode: boolean;
|
||||||
|
|
||||||
let htmlDescription: string;
|
let htmlDescription: string;
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
import CardsHeader from '../CardsHeader.svelte';
|
import CardsHeader from '../CardsHeader.svelte';
|
||||||
import SystemBody from './Body.svelte';
|
import SystemBody from './Body.svelte';
|
||||||
import SystemPrivacy from './Privacy.svelte';
|
import SystemPrivacy from './Privacy.svelte';
|
||||||
|
import type Sys from '../../api/system';
|
||||||
|
|
||||||
export let user;
|
export let user: Sys;
|
||||||
export let isPublic = true;
|
export let isPublic = true;
|
||||||
|
|
||||||
let editMode = false;
|
let editMode = false;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Card, CardHeader, CardBody, CardTitle, Row, Col, Button } from 'sveltestrap';
|
import { Card, CardHeader, CardBody, CardTitle, Row, Col, Button } from 'sveltestrap';
|
||||||
import FaUserLock from 'svelte-icons/fa/FaUserLock.svelte'
|
import FaUserLock from 'svelte-icons/fa/FaUserLock.svelte'
|
||||||
|
import type Sys from '../../api/system';
|
||||||
|
|
||||||
export let user;
|
export let user: Sys;
|
||||||
let editMode = false;
|
let editMode = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import System from '../lib/system/Main.svelte';
|
import System from '../lib/system/Main.svelte';
|
||||||
import PKAPI from '../api';
|
import PKAPI from '../api';
|
||||||
import type Sys from '../api/system';
|
import Sys from '../api/system';
|
||||||
|
|
||||||
let isPublic = false;
|
let isPublic = false;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// if there is no cached user, get the user from localstorage
|
// 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
|
// since the user in localstorage can be outdated, fetch the user from the api again
|
||||||
if (!current) {
|
if (!current) {
|
||||||
login(localStorage.getItem("pk-token"));
|
login(localStorage.getItem("pk-token"));
|
||||||
|
Loading…
Reference in New Issue
Block a user