-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from Dilden/iss52
Changes necessary to update SvelteKit.
- Loading branch information
Showing
16 changed files
with
2,280 additions
and
689 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,5 +73,6 @@ | |
width: 90vw; | ||
height: auto; | ||
max-width: 1000px; | ||
z-index: -1; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const prerender = true; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
import { facts } from '$utils/nutrients'; | ||
|
||
export async function get({ url }) { | ||
export async function GET({ url }) { | ||
const code = url.searchParams.get('barcode'); | ||
|
||
const res = await fetch(`https://redsky.target.com/redsky_aggregations/v1/apps/product_from_barcode_v1?barcode=${code}&pricing_store_id=530&key=5d546952f5059b16db4aa90913e56d09d3ff2aa4`) | ||
.then(res => res.json()) | ||
.then(response => response.json()) | ||
.then(json => facts(json.data.product_by_barcode.tcin)); | ||
|
||
// SvelteKit server endpoints must return a Response object | ||
// https://kit.svelte.dev/docs/routing#server | ||
if(res) { | ||
return { | ||
body: res | ||
}; | ||
return new Response(JSON.stringify(res)); | ||
} | ||
|
||
return { | ||
status: 404 | ||
}; | ||
const error = new Response(new String(), {status: 404, statusText: 'UPC not found'}); | ||
return error; | ||
} |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,13 @@ | ||
import adapter from '@sveltejs/adapter-node'; | ||
import path from 'path'; | ||
|
||
/** @type {import('@sveltejs/kit').Config} */ | ||
const config = { | ||
kit: { | ||
adapter: adapter({ | ||
fallback: '200.html' | ||
}), | ||
prerender: { | ||
default: true | ||
}, | ||
trailingSlash: 'always', | ||
vite: { | ||
server: { | ||
fs: { | ||
allow: ['static'] | ||
} | ||
}, | ||
preview: { | ||
port: 3001 | ||
}, | ||
resolve: { | ||
alias: { | ||
// set an alias so images can be dynamically imported | ||
$static: path.resolve('./static'), | ||
$components: path.resolve('./src/components'), | ||
$utils: path.resolve('./src/utils'), | ||
$stores: path.resolve('./src/stores') | ||
} | ||
}, | ||
ssr: { | ||
noExternal: ['chart.js'] | ||
} | ||
} | ||
} | ||
kit: { | ||
adapter: adapter({ | ||
fallback: '200.html' | ||
}), | ||
trailingSlash: 'always', | ||
} | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import path from 'path'; | ||
import { sveltekit } from '@sveltejs/kit/vite'; | ||
import basicSsl from '@vitejs/plugin-basic-ssl'; | ||
|
||
/** @type {import('vite').UserConfig} */ | ||
const config = { | ||
plugins: [sveltekit(), basicSsl()], | ||
server: { | ||
fs: { | ||
allow: ['static'] | ||
}, | ||
https: true, | ||
port: 3000, | ||
strictPort: true | ||
}, | ||
resolve: { | ||
alias: { | ||
// set an alias so images can be dynamically imported | ||
$static: path.resolve('./static'), | ||
$components: path.resolve('./src/components'), | ||
$utils: path.resolve('./src/utils'), | ||
$stores: path.resolve('./src/stores') | ||
} | ||
}, | ||
ssr: { | ||
noExternal: ['chart.js'] | ||
} | ||
}; | ||
export default config; |