0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-17 22:44:24 -05:00

Fix examples smoke test fail (#8923)

This commit is contained in:
Bjorn Lu 2023-10-26 19:13:43 +08:00 committed by GitHub
parent c8976440ff
commit ec7f531682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 31 deletions

View file

@ -14,10 +14,10 @@ import Container from '../components/Container.astro';
<script type="module" is:inline>
document.addEventListener('DOMContentLoaded', () => {
console.log('loaded');
document.querySelector('form').addEventListener('submit', (e) => {
const form = document.querySelector('form');
if (!form) throw new Error('Form not found');
form.addEventListener('submit', (e) => {
e.preventDefault();
const form = e.target;
const formData = new FormData(form);
const data = Object.fromEntries(formData);
@ -26,10 +26,13 @@ import Container from '../components/Container.astro';
body: JSON.stringify(data),
})
.then((res) => res.json())
.then((data) => {
document.querySelector('#result').innerHTML =
.then(() => {
const result = document.querySelector('#result');
if (result) {
result.innerHTML =
'Progressive login was successful! you will be redirected to the store in 3 seconds';
setTimeout(() => (location.href = '/'), 3000);
}
});
});
});

View file

@ -64,7 +64,7 @@ export function get(context) {
// provide a base URL for RSS <item> links
site: context.site,
// list of `<item>`s in output xml
items: [...],
items: [],
// (optional) absolute path to XSL stylesheet in your project
stylesheet: '/rss-styles.xsl',
// (optional) inject custom xml
@ -72,7 +72,7 @@ export function get(context) {
// (optional) add arbitrary metadata to opening <rss> tag
xmlns: { h: 'http://www.w3.org/TR/html4/' },
// (optional) add trailing slashes to URLs (default: true)
trailingSlash: false
trailingSlash: false,
});
}
```
@ -98,9 +98,10 @@ The base URL to use when generating RSS item links. We recommend using the [endp
```ts
import rss from '@astrojs/rss';
export const get = (context) => rss({
export const get = (context) =>
rss({
site: context.site,
...
// ...
});
```

View file

@ -2607,12 +2607,12 @@
```js
import { defineConfig } from 'astro/config';
export defaultdefineConfig({
export default defineConfig({
output: 'hybrid',
experimental: {
hybridOutput: true,
},
})
});
```
Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering.

View file

@ -210,12 +210,12 @@
```js
import { defineConfig } from 'astro/config';
export defaultdefineConfig({
export default defineConfig({
output: 'hybrid',
experimental: {
hybridOutput: true,
},
})
});
```
Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering.

View file

@ -553,12 +553,12 @@
```js
import { defineConfig } from 'astro/config';
export defaultdefineConfig({
export default defineConfig({
output: 'hybrid',
experimental: {
hybridOutput: true,
},
})
});
```
Then add `export const prerender = false` to any page or endpoint you want to opt-out of pre-rendering.

View file

@ -209,7 +209,7 @@
});
```
```js
```ts
// src/pages/_app.ts
import type { App } from 'vue';
import i18nPlugin from '../plugins/i18n';

View file

@ -116,7 +116,7 @@ export default defineConfig({
});
```
```js
```ts
// src/pages/_app.ts
import type { App } from 'vue';
import i18nPlugin from 'my-vue-i18n-plugin';