mirror of
https://github.com/quepasaevents/qpa-client.git
synced 2023-12-14 05:33:02 +01:00
Set up a React app
This commit is contained in:
parent
4061817220
commit
e2ed9e7683
10
client/.babelrc
Normal file
10
client/.babelrc
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"presets": [
|
||||
"@babel/env",
|
||||
"@babel/preset-typescript"
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/proposal-class-properties",
|
||||
"@babel/proposal-object-rest-spread"
|
||||
]
|
||||
}
|
6
client/App/App.tsx
Normal file
6
client/App/App.tsx
Normal file
|
@ -0,0 +1,6 @@
|
|||
import * as React from 'react'
|
||||
|
||||
const App = () => (
|
||||
<h1>Hello from app</h1>
|
||||
)
|
||||
export default App
|
10
client/App/index.tsx
Normal file
10
client/App/index.tsx
Normal file
|
@ -0,0 +1,10 @@
|
|||
import * as React from 'react'
|
||||
import * as ReactDOM from 'react-dom'
|
||||
import App from './App'
|
||||
|
||||
const appWrapper = document.createElement('div')
|
||||
document.body.appendChild(appWrapper)
|
||||
console.log('appWrapper', appWrapper)
|
||||
ReactDOM.render(<App />, appWrapper)
|
||||
|
||||
export default App
|
38
client/webpack.config.ts
Normal file
38
client/webpack.config.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
import * as webpack from 'webpack'
|
||||
import * as path from "path"
|
||||
import * as HtmlWebpackPlugin from 'html-webpack-plugin'
|
||||
|
||||
const config: webpack.Configuration = {
|
||||
entry: './App/index.tsx',
|
||||
resolve: {
|
||||
extensions: [".js", ".jsx", ".ts", ".tsx"]
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
exclude: path.resolve(__dirname, "node_modules"),
|
||||
test: /\.tsx?$/,
|
||||
use: {
|
||||
loader: "babel-loader",
|
||||
options: {
|
||||
presets: [
|
||||
"@babel/typescript",
|
||||
"@babel/react"
|
||||
],
|
||||
plugins: [].filter(Boolean)
|
||||
}
|
||||
}
|
||||
} ]
|
||||
},
|
||||
devtool: '#@source-map',
|
||||
output: {
|
||||
path: path.resolve(__dirname, './dist'),
|
||||
filename: 'bundle.js'
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin({
|
||||
title: "blabla",
|
||||
})]
|
||||
|
||||
}
|
||||
|
||||
export default config
|
|
@ -149,4 +149,8 @@ describe("Events resolver", () => {
|
|||
expect(res.data.events[0].info.title).toEqual("Knitting Test Event")
|
||||
done()
|
||||
})
|
||||
|
||||
it('Get events by user', async done => {
|
||||
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Event} from "../Calendar/Event.entity"
|
||||
import {ResolverMap} from "../@types/graphql-utils"
|
||||
import {Context, ResolverMap} from "../@types/graphql-utils"
|
||||
import {GQL} from "../@types"
|
||||
|
||||
const resolvers: ResolverMap = {
|
||||
|
@ -19,7 +19,10 @@ const resolvers: ResolverMap = {
|
|||
},
|
||||
|
||||
Mutation: {
|
||||
createEvent: async (_, { input }: GQL.ICreateEventOnMutationArguments, context, info) => {
|
||||
createEvent: async (_, { input }: GQL.ICreateEventOnMutationArguments, context: Context, info) => {
|
||||
if (!context.user) {
|
||||
throw Error('not authenticated')
|
||||
}
|
||||
const event = new Event()
|
||||
event.owner = context.user
|
||||
return null
|
||||
|
|
|
@ -4,7 +4,7 @@ Abbreviations:
|
|||
|
||||
## Mile Stone I (MVP)
|
||||
### Event Owner specific user stories
|
||||
-[ ] As an event owner I would like to be able to log in using my email, so that I can manage my events
|
||||
-[x] As an event owner I would like to be able to log in using my email, so that I can manage my events
|
||||
-[ ] As an event owner I would like to see an overview of my events
|
||||
-[ ] As an event owner I would like to be able to create a simple event
|
||||
-[ ] As an event owner I would like to be able to update any event that I own
|
||||
|
|
|
@ -58,8 +58,6 @@ export const createServer = async (dependencies: Dependencies) => {
|
|||
}
|
||||
if (a.req && a.req.headers.authentication) {
|
||||
const session = await Session.findOne({hash: a.req.headers.authentication as string})
|
||||
console.log('session!!!', session)
|
||||
console.log('await',await session.user)
|
||||
if (session) {
|
||||
ctx.user = session.user
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue