1
0
Fork 0

wip(org): Work on signup/signin pages

This commit is contained in:
Joost De Cock 2022-12-27 18:20:53 +01:00
parent cb3614c109
commit 636feb877d
6 changed files with 240 additions and 12 deletions

23
sites/shared/backend.mjs Normal file
View file

@ -0,0 +1,23 @@
import axios from 'axios'
/*
* Helper methods to interact with the FreeSewing backend
*/
const backend = axios.create({
baseURL: process.env.NEXT_PUBLIC_BACKEND || 'https://backend.freesewing.org',
timeout: 3000,
})
export const signUp = async ({ email, language, startLoading, stopLoading }) => {
let result
try {
startLoading()
result = await backend.post('/signup', { email, language })
} catch (err) {
console.log({ err })
} finally {
if (result) console.log({ result })
stopLoading()
}
}