Skip to content

Commit

Permalink
Merge branch 'main' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Jan 6, 2024
2 parents 5955442 + 8d1081c commit 5073342
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 29 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@
"esbuild",
"@sveltejs/kit"
]
}
}
4 changes: 4 additions & 0 deletions src/gql/users/user.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ query GetUser($user: UserID!) {
note
}
}
tags {
id
name
}
}
}
guides {
Expand Down
24 changes: 6 additions & 18 deletions src/lib/components/auth/LoginDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
OAuthGoogleDocument,
LogoutDocument
} from '$lib/generated';
import { getContextClient, queryStore } from '@urql/svelte';
import { getContextClient } from '@urql/svelte';
import { browser } from '$app/environment';
import { page } from '$app/stores';
import { user, userToken } from '$lib/stores/user';
Expand All @@ -23,14 +23,6 @@
export const { t } = getTranslate();
if (browser) {
const getMe = queryStore({
query: GetMeDocument,
client,
variables: {},
requestPolicy: 'network-only',
pause: true
});
let first = true;
userToken.subscribe((token) => {
if (token) {
Expand All @@ -54,20 +46,16 @@
first = false;
if (token) {
getMe.pause();
getMe.resume();
const unsub = getMe.subscribe((response) => {
if (!response.fetching) {
client
.query(GetMeDocument, {}, { requestPolicy: 'network-only' })
.toPromise()
.then((response) => {
if (response.error) {
console.error(response.error.message);
unsub();
} else if (response.data) {
user.set(response.data.getMe);
unsub();
}
}
});
});
} else {
user.set(null);
}
Expand Down
2 changes: 1 addition & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
export let data: PageData;
const { mods } = data;
$: ({ mods } = data);
export const { t } = getTranslate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
export let data: PageData;
const { smlVersionId } = data;
$: ({ smlVersionId } = data);
const client = getContextClient();
const toastStore = getToastStore();
const smlVersion = queryStore({
$: smlVersion = queryStore({
query: GetSmlVersionAdminDocument,
client,
variables: { smlVersionID: smlVersionId }
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/routes/guide/[guideId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
export let data: PageData;
const { guideId, guide } = data;
$: ({ guideId, guide } = data);
const client = getContextClient();
Expand Down
4 changes: 2 additions & 2 deletions src/routes/guide/[guideId]/edit/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
export let data: PageData;
const { guideId } = data;
$: ({ guideId } = data);
const client = getContextClient();
const toastStore = getToastStore();
const guide = queryStore({
$: guide = queryStore({
query: GetGuideDocument,
client,
variables: { guide: guideId }
Expand Down
2 changes: 1 addition & 1 deletion src/routes/mod/[modId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
export let data: PageData;
const { modId, mod } = data;
$: ({ modId, mod } = data);
const client = getContextClient();
Expand Down
4 changes: 2 additions & 2 deletions src/routes/mod/[modId]/version/[versionId]/edit/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
export let data: PageData;
const { modId, versionId } = data;
$: ({ modId, versionId } = data);
const client = getContextClient();
const toastStore = getToastStore();
const version = queryStore({
$: version = queryStore({
query: GetModVersionDocument,
client,
variables: { version: versionId }
Expand Down
2 changes: 1 addition & 1 deletion src/routes/user/[userId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
export let data: PageData;
const { user } = data;
$: ({ user } = data);
let guidesTab = false;
</script>
Expand Down

0 comments on commit 5073342

Please sign in to comment.