Skip to content

Commit

Permalink
fix: make queryStores reactive to get valid variables (#103)
Browse files Browse the repository at this point in the history
* fix: make queryStores reactive to get valid variables

* chore: readme info about testing local sign in

---------

Co-authored-by: Rob B <[email protected]>
  • Loading branch information
mircearoata and budak7273 authored Jul 28, 2023
1 parent 48d62f7 commit 8d1081c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 9 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,11 @@ and will start a development server on port 3000.
If you don't wish to run the backend locally (which most likely you don't),
you can point your local frontend to the staging or production APIs by specifying a different `NODE_ENV`,
such as `staging`.

### Login

Trying to log in on a locally hosted copy of the frontend will fail and redirect you to the live site
because of how the OAuth sign in process works.
To work around this, copy the `token` cookie produced by signing into the real site (`.ficsit.app`)
and add it to your cookies for `localhost`.
There is likely a cookie manager extension for your browser of choice that will make this easier.
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// language - current active spelling language
"language": "en",
// words - list of words to be always considered correct
"words": ["cfworker", "felte", "prismjs", "smui", "urql", "wonka"],
"words": ["cfworker", "felte", "ficsit", "prismjs", "smui", "urql", "wonka"],
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
// cSpell:disable (don't complain about the words we listed here)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/mods/ModVersions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
let expandedVersions = new Set<string>();
// TODO Pagination
const versions = queryStore({
$: versions = queryStore({
query: GetModVersionsDocument,
client,
variables: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
let errorMessage = '';
let errorToast = false;
const smlVersion = queryStore({
$: smlVersion = queryStore({
query: GetSmlVersionAdminDocument,
client,
variables: { smlVersionID: smlVersionId }
Expand Down
2 changes: 1 addition & 1 deletion src/routes/guide/[guideId]/edit/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
let errorMessage = '';
let errorToast = false;
const guide = queryStore({
$: guide = queryStore({
query: GetGuideDocument,
client,
variables: { guide: guideId }
Expand Down
5 changes: 2 additions & 3 deletions src/routes/mod/[modId]/edit/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import { base } from '$app/paths';
import MetaDescriptors from '$lib/components/utils/MetaDescriptors.svelte';
import Card, { Content } from '@smui/card';
import { get } from 'svelte/store';
import type { PageData } from './$types';
export let data: PageData;
Expand All @@ -20,7 +19,7 @@
let errorMessage = '';
let errorToast = false;
const mod = queryStore({
$: mod = queryStore({
query: GetModDocument,
client,
variables: { mod: modId }
Expand All @@ -29,7 +28,7 @@
const onSubmit = (modData: ModData) => {
client
.mutation(EditModDocument, {
modId: get(mod).data.mod.id,
modId: $mod.data.mod.id,
mod: modData
})
.toPromise()
Expand Down
2 changes: 1 addition & 1 deletion src/routes/mod/[modId]/new-version/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
let errorMessage = '';
let errorToast = false;
const mod = queryStore({
$: mod = queryStore({
query: GetModReferenceDocument,
client,
variables: { mod: modId }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
let errorMessage = '';
let errorToast = false;
const version = queryStore({
$: version = queryStore({
query: GetModVersionDocument,
client,
variables: { version: versionId }
Expand Down

0 comments on commit 8d1081c

Please sign in to comment.