Convert multiple pages into SPA
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import Modal from "util/Modal.svelte";
|
||||
import LoadingIndicator from "util/LoadingIndicator.svelte";
|
||||
import { get_user, put_user } from "lib/PixeldrainAPI";
|
||||
import { loading_finish, loading_start } from "lib/Loading";
|
||||
|
||||
// When the always flag is set then the pop-up will also show if the user
|
||||
// already has an affiliate ID set
|
||||
export let always = false
|
||||
let modal: Modal
|
||||
let loading: boolean
|
||||
let referral: string
|
||||
let shown = false
|
||||
|
||||
@@ -50,7 +49,7 @@ export const prompt = async (ref: string) => {
|
||||
onMount(() => prompt(new URLSearchParams(document.location.search).get("ref")))
|
||||
|
||||
const allow = async () => {
|
||||
loading = true
|
||||
loading_start()
|
||||
try {
|
||||
await put_user({affiliate_user_name: referral})
|
||||
|
||||
@@ -59,7 +58,7 @@ const allow = async () => {
|
||||
} catch (err) {
|
||||
alert(err)
|
||||
} finally {
|
||||
loading = false
|
||||
loading_finish()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +69,6 @@ const deny = () => {
|
||||
</script>
|
||||
|
||||
<Modal bind:this={modal} title="Affiliate sponsoring request" width="700px">
|
||||
<LoadingIndicator bind:loading={loading} />
|
||||
<section>
|
||||
<p>
|
||||
Hi! {referral} wants you to sponsor their pixeldrain account. This
|
||||
|
||||
Reference in New Issue
Block a user