-
change how you access goto -- from:
import { goto } from "@sapper/app";
-- to:import { goto } from "$app/navigation";
-
change how you access sessions --from:
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
<-- place this in the Custom Code section, or in a clode block below the form --> | |
<script> | |
var form= document.querySelector('form'); | |
var submitBtn= document.getElementById('submit'); | |
var textareaWrap= document.createElement('div'); | |
textareaWrap.className= 'relative db cf'; | |
var textareaLabel= document.createElement('label'); | |
textareaLabel.innerHTML= 'Textarea Label Here'; | |
textareaWrap.appendChild(textareaLabel); | |
var textarea= document.createElement('textarea'); |
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
import pkg from 'pdf-lib/cjs/index.js'; | |
const { PDFDocument } = pkg; | |
export const get = async (req, context) => { | |
const pdfDoc = await PDFDocument.create(); | |
const page = pdfDoc.addPage(); | |
page.drawText('You can create PDFs!'); | |
const pdfBytes = await pdfDoc.save(); | |
return { | |
body: Buffer.from(pdfBytes, 'binary'), |
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
import { firebase } from "$services/firebaseAdmin"; | |
export const get = async (req, context) => { | |
const globalRef = firebase.firestore().collection('global'); | |
let data = { | |
now: Date.now() | |
}; | |
const snapshot = await globalRef.get(); | |
snapshot.forEach(doc => { |
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
import admin from "firebase-admin"; | |
if (!admin.apps.length) { | |
admin.initializeApp({ | |
credential: admin.credential.applicationDefault(), | |
databaseURL: 'your-url' // ... | |
}); | |
}; | |
const firebase = admin; |
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
import { initializeApp } from 'firebase/app'; | |
import { getAuth, onAuthStateChanged } from "firebase/auth"; | |
import { getFirestore } from 'firebase/firestore'; | |
import { getStorage } from "firebase/storage"; | |
let ssrAuthed = window.ssrUser; | |
const firebaseConfig = { | |
// ... | |
}; |
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
<script> | |
import "./styles.css"; | |
import { session } from "$app/stores"; | |
import { onMount, setContext } from "svelte"; | |
import { writable } from "svelte/store"; | |
let store = writable({}); | |
setContext("store", store); | |
$: user = $session.user || null; | |
onMount(async () => { |
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
import * as cookie from 'cookie'; | |
import { firebase } from "$services/server/firebase"; | |
const firestore = firebase.firestore(); | |
export async function getContext({ headers }) { | |
let user = null; | |
try { | |
const cookies = cookie.parse(headers.cookie || ""); | |
const sessionId = cookies["__session"]; |
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
<script> | |
window.success= function(){ | |
if(formData['Finance-Pre-Approved']==='Yes'){ | |
redirect= "https://stellaproperty.phonesites.com/getfinanceprequalified"; | |
}else if(formData['Finance-Pre-Approved']==='No'){ | |
redirect= "https://phonesites.com"; | |
}; | |
}; | |
</script> |
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
<script> | |
window.success= function(){ | |
if(formData.url==='A'){ | |
redirect= "https://google.com"; | |
}else if(formData.url==='B'){ | |
redirect= "https://phonesites.com"; | |
}else if(formData.url==='C'){ | |
redirect= "https://yahoo.com"; | |
}; | |
}; |