feat: loading spinner and re-add hydration

This commit is contained in:
Ax333l
2022-10-22 13:06:55 +02:00
committed by afn
parent aac71915e5
commit 9b97f062c6
7 changed files with 91 additions and 70 deletions

View File

@@ -1,12 +0,0 @@
import { readable } from 'svelte/store';
import type { Repository } from 'src/data/types';
export type ContribData = { repositories: Repository[] };
const fetchContributors = async (): Promise<ContribData> => {
const response = await fetch('https://releases.rvcd.win/contributors');
const data = await response.json();
return data;
};
export const ContributorsStore = readable(fetchContributors());

View File

@@ -1,23 +0,0 @@
import { readable } from 'svelte/store';
import type { Patch } from 'src/data/types';
export type PatchesData = { patches: Patch[]; packages: string[] };
const fetchPatches = async (): Promise<PatchesData> => {
const response = await fetch('https://releases.rvcd.win/patches');
const patches = await response.json();
let packages: string[] = [];
// gets packages
for (let i = 0; i < patches.length; i++) {
patches[i].compatiblePackages.forEach((pkg: Patch) => {
let index = packages.findIndex((x) => x == pkg.name);
if (index === -1) {
packages.push(pkg.name);
}
});
}
return { patches, packages };
};
export const PatchesStore = readable(fetchPatches());