fix: guard upload and edit post pages

This commit is contained in:
Damillora 2021-05-11 04:05:55 +07:00
parent 5d239b0a05
commit e5a0340680
4 changed files with 282 additions and 180 deletions

View File

@ -4,6 +4,7 @@
import Tags from "svelte-tags-input"; import Tags from "svelte-tags-input";
import { onMount } from "svelte"; import { onMount } from "svelte";
import { Link } from "svelte-routing"; import { Link } from "svelte-routing";
import AuthRequired from "../AuthRequired.svelte";
export let id; export let id;
@ -35,6 +36,8 @@
}); });
</script> </script>
<AuthRequired />
<section class="hero is-primary"> <section class="hero is-primary">
<div class="hero-body"> <div class="hero-body">
<p class="title">Edit Post: {id}</p> <p class="title">Edit Post: {id}</p>
@ -46,9 +49,7 @@
<div class="columns"> <div class="columns">
<div class="column is-one-third box"> <div class="column is-one-third box">
<p> <p>
<Link class="button is-primary" to="/post/{id}" <Link class="button is-primary" to="/post/{id}">Back</Link>
>Back</Link
>
</p> </p>
<form on:submit|preventDefault={onSubmit}> <form on:submit|preventDefault={onSubmit}>
<div class="field"> <div class="field">
@ -68,7 +69,7 @@
<div class="control" id="tags"> <div class="control" id="tags">
<Tags <Tags
tags={form.tags} tags={form.tags}
addKeys={[9,32]} addKeys={[9, 32]}
on:tags={onTagChange} on:tags={onTagChange}
/> />
</div> </div>

View File

@ -2,6 +2,7 @@
import { uploadBlob, postCreate } from "../api.js"; import { uploadBlob, postCreate } from "../api.js";
import { navigate } from "svelte-routing"; import { navigate } from "svelte-routing";
import Tags from "svelte-tags-input"; import Tags from "svelte-tags-input";
import AuthRequired from "../AuthRequired.svelte";
let currentProgress = 0; let currentProgress = 0;
@ -38,6 +39,8 @@
}; };
</script> </script>
<AuthRequired />
<section class="hero is-primary"> <section class="hero is-primary">
<div class="hero-body"> <div class="hero-body">
<p class="title">Upload</p> <p class="title">Upload</p>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long