This commit is contained in:
ingego 2024-10-14 14:20:20 +06:00
parent e6291ff475
commit 6d0f119c41
9 changed files with 4782 additions and 30 deletions

View File

@ -36,3 +36,30 @@ npm run build
You can preview the production build with `npm run preview`. You can preview the production build with `npm run preview`.
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
SERVER (WEB SERVER )
client -> GET -> server (html/css/js)
dist (DATA) 300kb
CACHE -> html/css/js
COOKIES -> EVENTS ( login/password, last session)
LocalStorage --> ( key-object database ) (MORE DATA > 60 days)

22
codegen.ts Normal file
View File

@ -0,0 +1,22 @@
import { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: 'http://localhost:1337/graphql',
// this assumes that all your source files are in a top-level `src/` directory - you might need to adjust this to your file structure
documents: ['src/**/*.{ts,tsx}'],
generates: {
'./src/__generated__/': {
preset: 'client',
plugins: [
"typescript",
"typescript-operations"
],
presetConfig: {
gqlTagName: 'gql',
}
}
},
ignoreNoDocuments: true,
};
export default config;

4714
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@
"test:unit": "vitest" "test:unit": "vitest"
}, },
"devDependencies": { "devDependencies": {
"@graphql-codegen/cli": "^5.0.3",
"@playwright/test": "^1.28.1", "@playwright/test": "^1.28.1",
"@sveltejs/adapter-auto": "^3.0.0", "@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0", "@sveltejs/kit": "^2.0.0",
@ -32,7 +33,7 @@
"svelte": "^5.0.0-next.1", "svelte": "^5.0.0-next.1",
"svelte-check": "^4.0.0", "svelte-check": "^4.0.0",
"tailwindcss": "^3.4.13", "tailwindcss": "^3.4.13",
"typescript": "^5.0.0", "typescript": "^5.6.3",
"vite": "^5.0.3", "vite": "^5.0.3",
"vitest": "^2.0.0" "vitest": "^2.0.0"
}, },
@ -41,6 +42,7 @@
"@apollo/client": "^3.11.8", "@apollo/client": "^3.11.8",
"@types/uuid": "^10.0.0", "@types/uuid": "^10.0.0",
"axios": "^1.7.7", "axios": "^1.7.7",
"graphql": "^16.9.0",
"graphql-request": "^7.1.0", "graphql-request": "^7.1.0",
"svelte-icons": "^2.1.0", "svelte-icons": "^2.1.0",
"svelte-icons-pack": "^3.1.3" "svelte-icons-pack": "^3.1.3"

View File

@ -0,0 +1,10 @@
import type { LayoutServerLoad } from "./$types";
export const load = (async ({ cookies }) => {
let user = cookies.get("hresssdfs")
return {
"islogin":user==null?false: true
}
}) satisfies LayoutServerLoad;

View File

@ -1,5 +1,9 @@
<script> <script>
import "../app.css"; import "../app.css";
</script>
export let data;
</script>
{
data.islogin?"в системе":"нужно логиниться"
}
<slot></slot> <slot></slot>

View File

@ -0,0 +1,6 @@
import type { PageServerLoad } from "./$types";
export const load = (({ }) => {
}) satisfies PageServerLoad;

View File

@ -1,2 +1,3 @@
<h1 class= "">Welcome to SvelteKit</h1> <h1 class= " text-4xl">Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p> <p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>

20
src/routes/api/+server.ts Normal file
View File

@ -0,0 +1,20 @@
export const GET = (({cookies}) => {
return Response.json({"test":"test"}) ;
})
export const POST = (() => {
return Response.json({"test":"test"}) ;
})
export const PUT = (() => {
return Response.json({"test":"test"}) ;
})
export const DELETE = (() => {
return Response.json({"test":"test"}) ;
})