Added basic comments.
This commit is contained in:
@@ -12,7 +12,7 @@ async function render(pageContext) {
|
||||
const title = (documentProps && documentProps.title) || 'shack';
|
||||
const desc = (documentProps && documentProps.description) || 'Shack';
|
||||
|
||||
const { app, store } = createApp(pageContext);
|
||||
const { app } = createApp(pageContext);
|
||||
const stream = renderToNodeStream(app);
|
||||
|
||||
const documentHtml = escapeInject`
|
||||
@@ -38,14 +38,28 @@ async function render(pageContext) {
|
||||
return {
|
||||
documentHtml,
|
||||
pageContext: {
|
||||
initialState: store.state.value,
|
||||
// initialState: store.state.value,
|
||||
enableEagerStreaming: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async function onBeforeRender(pageContext) {
|
||||
const pageData = await pageContext.exports.getPageData?.(pageContext, pageContext.session);
|
||||
|
||||
return {
|
||||
pageContext: {
|
||||
// initialState: store.state.value,
|
||||
pageData,
|
||||
user: pageContext.session.user,
|
||||
now: new Date(),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export {
|
||||
render,
|
||||
onBeforeRender,
|
||||
};
|
||||
|
||||
export const passToClient = ['urlPathname', 'initialState', 'pageData', 'pageProps', 'routeParams'];
|
||||
export const passToClient = ['urlPathname', 'initialState', 'pageData', 'pageProps', 'routeParams', 'user', 'now'];
|
||||
|
||||
@@ -33,20 +33,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// import { onMounted } from 'vue';
|
||||
// import { usePageContext } from './usePageContext';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import logo from '../assets/img/logo.svg?raw';
|
||||
|
||||
import logo from '../assets/img/logo.svg?raw'; // eslint-disable-line import/no-unresolved
|
||||
import { del } from '../assets/js/api';
|
||||
import { useUser } from '../stores/user';
|
||||
import { usePageContext } from './usePageContext';
|
||||
|
||||
// const pageContext = usePageContext();
|
||||
const { user } = usePageContext();
|
||||
const version = CLIENT_VERSION;
|
||||
|
||||
const userStore = useUser();
|
||||
const { user } = storeToRefs(userStore);
|
||||
|
||||
async function logout() {
|
||||
await del('/api/session');
|
||||
window.location.href = '/account/login';
|
||||
|
||||
Reference in New Issue
Block a user