Commit 257d3a48 authored by David Sveningsson's avatar David Sveningsson
Browse files

fulhackar "PUT", CORS vill inte komma överens

parent 04853a4a
......@@ -10,13 +10,21 @@ items = []
ansokningar = []
class Ansokan(Resource):
def post(self):
global ansokanId
ansokan = request.get_json()
ansokan['id'] = int(time.time())
ansokan['timestamp'] = int(time.time())
ansokningar.append(ansokan)
return ansokningar, 201
def post(self, id=None):
if id:
ansokan = self.findAnsokan(id)
if ansokan is None:
return '', 404
else:
ansokan.update(request.get_json())
return ansokan
else:
global ansokanId
ansokan = request.get_json()
ansokan['id'] = int(time.time())
ansokan['timestamp'] = int(time.time())
ansokningar.append(ansokan)
return ansokningar, 201
def get(self, id=None):
if id:
......@@ -27,16 +35,6 @@ class Ansokan(Resource):
else:
return ansokningar
def put(self, id=None):
#id, fält, comment
ansokan = self.findAnsokan(id)
if ansokan is None:
return '', 404
else:
ansokan.update(request.get_json())
return ansokan
def delete(self, id):
global ansokningar
ansokningar = list(filter(lambda x: x['id'] != id, ansokningar))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment