-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path+page.svelte
134 lines (106 loc) · 2.02 KB
/
+page.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<script lang="ts">
// imports
import { Ollesvege } from 'ollesvege';
import _ from 'lodash';
import { onDestroy, onMount } from 'svelte';
import Loader from '../components/Loader.svelte';
import Placeholder from '../components/Placeholder.svelte';
import * as api from '../assets/js/api';
// exports
// none
// consts
const IN_MAINTENANCE = false;
// vars
let is_active = false;
let data;
let user;
// dynamics
// none
// mount
onMount(async () => {
if (IN_MAINTENANCE) {
return;
}
if (!is_active) {
is_active = true;
}
await getData();
});
onDestroy(() => {
try {
is_active = false;
} catch (e) {
console.log(e);
}
});
// jobs
let jobs = [`get_data`];
async function getData() {
try {
jobs.push(`get_data`);
jobs = jobs;
user = await api.getCurrentUser() || null;
if (!(user && user.id)) {
user = null;
}
// data = await api.restPost({
// url: `load`,
// payload: {
// type: `landing_main`,
// obj: {
// user_id: user ? user.id : ``
// }
// }
// }) || null;
data = `test`;
if (data) {
// todo: data
}
jobs = jobs.filter(j => j !== `get_data`);
} catch (e) {
console.log(e);
}
}
// execs
// none
// funcs
// none
</script>
<!-- landing -->
<div
class="container grow-- col-- col-centre-- col-middle-- text text-white-- landing"
>
{#if IN_MAINTENANCE}
<Placeholder
is_loading={false}
text="In maintenance."
colour="red"
/>
{:else if jobs.includes(`get_data`)}
<Placeholder
is_loading={true}
text="Loading..."
colour="white"
/>
{:else if !data}
<Placeholder
is_loading={false}
text="Error loading."
colour="red"
/>
{:else}
Ollesvelke
<!-- note: sample component - https://github.com/lefrost/ollesvege -->
<Ollesvege
sample_text="Testing Ollesvege component"
/>
{/if}
</div>
<style lang="scss">
@import '../assets/scss/all.scss';
// landing
.landing {
width: calc(100% - $wrapper-gutter * 2);
max-width: 1000px;
}
</style>