Ignore:
Timestamp:
08/06/13 01:48:17 (12 years ago)
Author:
hendrikvanantwerpen
Message:

Quick hack to allow responding despite not being authenticated. Something like tokes need to be added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/response.js

    r443 r477  
    11define([
    2     'dojo/date',
    3     'dojo/date/locale',
    4     'dojo/hash',
    5     'dojo/parser',
    6     './store',
    7     './app/Content',
    8     './app/Page',
    9     './app/Path',
    10     './lib/async',
    11     './model/classes/Response',
    12     './model/classes/SurveyRun',
    13     './pages/response',
    14     'dojo/domReady!',
    15     './stddeps'
    16 ],function(date,locale,hash,parser,store,Content,Page,Path,async,Response,SurveyRun,ResponsePage) {
     2    "./app/Content",
     3    "./app/Page",
     4    "./app/Path",
     5    "./lib/async",
     6    "./model/classes/Response",
     7    "./model/classes/SurveyRun",
     8    "./pages/response",
     9    "./store",
     10    "dojo/_base/json",
     11    "dojo/date",
     12    "dojo/date/locale",
     13    "dojo/hash",
     14    "dojo/parser",
     15    "dojo/request",
     16    "./stddeps",
     17    "dojo/domReady!"
     18], function(Content, Page, Path, async, Response, SurveyRun, ResponsePage, store, json, date, locale, hash, parser, request) {
    1719    parser.parse();
    1820    Content.startup();
     
    4951    }
    5052
    51     store.get(surveyRunId)
     53    request.get('/api/surveyRuns/'+surveyRunId,{handleAs:'json'})
    5254    .then(function(surveyRun){
    5355        checkDates(surveyRun);
     
    5860                var response = Response.create();
    5961                response.surveyRunId = surveyRunId;
    60                 return store.put(response).then(function(res){
    61                     return store.getIdentity(res);
     62                return request.post('/api/responses',{
     63                    handleAs:'json',
     64                    data:json.toJson(response),
     65                    headers:{"Content-Type": "application/json"}
     66                }).then(function(res){
     67                    return res.id;
    6268                });
    6369            } else {
Note: See TracChangeset for help on using the changeset viewer.