@@ -552,81 +552,6 @@ export default {
552552 });
553553 },
554554 },
555- watch: {
556- $route () {
557- if (this .$route .params .id !== undefined ) {
558- this .$store .dispatch (' setActivityIndex' , this .$route .params .id );
559- }
560- },
561- visibilityConditions: {
562- handler (newC ) {
563- if (! _ .isEmpty (newC)) {
564- this .setVisbility ();
565- }
566- },
567- deep: true ,
568- },
569- },
570- created () {
571- const url = this .$route .query .url ;
572- if (url) {
573- this .protocolUrl = url;
574- }
575- this .$store .dispatch (' getBaseSchema' , url).then (() => this .getPrefLabel ());
576- // this.$store.dispatch('getBaseSchema', url);
577- },
578- mounted () {
579- new EmailDecoder (' [data-email]' );
580- this .clientSpecs = JSON .stringify (Bowser .parse (window .navigator .userAgent ));
581- this .browserType = Bowser .parse (window .navigator .userAgent ).browser .name ;
582- if (config .checkMediaPermission ) {
583- this .checkPermission ();
584- }
585- if (this .$route .query .lang ) {
586- this .selected_language = this .$route .query .lang ;
587- i18n .locale = this .selected_language ;
588- } else this .selected_language = ' en' ;
589-
590- if (this .$route .query .uid ) {
591- // console.log(407, this.$route.query.uid);
592- this .$store .dispatch (' saveParticipantId' , this .$route .query .uid );
593- } else if (config .generateRandomUid ) {
594- this .$store .dispatch (' saveParticipantId' , uuidv4 ());
595- }
596- if (this .$route .params .id ) {
597- this .$store .dispatch (' setActivityIndex' , this .$route .params .id );
598- }
599- axios .get (' https://raw.githubusercontent.com/ReproNim/reproschema-library/master/resources/languages.json' ).then ((resp ) => {
600- this .langMap = resp .data ;
601- });
602- this .$store .dispatch (' setParticipantUUID' , uuidv4 ()); // set participant UUID for the current user
603- if (this .$route .query .expiry_time ) {
604- this .$store .dispatch (' setExpiryMinutes' , this .$route .query .expiry_time );
605- }
606- if (this .$route .query .auth_token ) {
607- this .$store .dispatch (' setAuthToken' , this .$route .query .auth_token );
608- }
609- if (! _ .isEmpty (this .$route .query )) {
610- this .$store .dispatch (' setQueryParameters' , this .$route .query );
611- }
612-
613- // const formData = new FormData();
614- // const TOKEN = this.$store.getters.getAuthToken;
615- // if (TOKEN) {
616- // formData.append('file', null);
617- // formData.append('auth_token', `${TOKEN}`);
618- // axios.post(`${config.backendServer}/submit`, formData, {
619- // 'Content-Type': 'multipart/form-data',
620- // }).then((res) => {
621- // // console.log('SUCCESS!!', res.status);
622- // })
623- // .catch((e) => {
624- // if (e.response.status === 403) {
625- // this.invalidToken = true;
626- // }
627- // });
628- // }
629- },
630555 computed: {
631556 accessDeniedPath () {
632557 let path = require (' ./assets/403-Access-Forbidden-HTML-Template.gif' );
@@ -817,6 +742,81 @@ export default {
817742 return this .$store .getters .getParticipantId ;
818743 },
819744 },
745+ mounted () {
746+ new EmailDecoder (' [data-email]' );
747+ this .clientSpecs = JSON .stringify (Bowser .parse (window .navigator .userAgent ));
748+ this .browserType = Bowser .parse (window .navigator .userAgent ).browser .name ;
749+ if (config .checkMediaPermission ) {
750+ this .checkPermission ();
751+ }
752+ if (this .$route .query .lang ) {
753+ this .selected_language = this .$route .query .lang ;
754+ i18n .locale = this .selected_language ;
755+ } else this .selected_language = ' en' ;
756+
757+ if (this .$route .query .uid ) {
758+ // console.log(407, this.$route.query.uid);
759+ this .$store .dispatch (' saveParticipantId' , this .$route .query .uid );
760+ } else if (config .generateRandomUid ) {
761+ this .$store .dispatch (' saveParticipantId' , uuidv4 ());
762+ }
763+ if (this .$route .params .id ) {
764+ this .$store .dispatch (' setActivityIndex' , this .$route .params .id );
765+ }
766+ axios .get (' https://raw.githubusercontent.com/ReproNim/reproschema-library/master/resources/languages.json' ).then ((resp ) => {
767+ this .langMap = resp .data ;
768+ });
769+ this .$store .dispatch (' setParticipantUUID' , uuidv4 ()); // set participant UUID for the current user
770+ if (this .$route .query .expiry_time ) {
771+ this .$store .dispatch (' setExpiryMinutes' , this .$route .query .expiry_time );
772+ }
773+ if (this .$route .query .auth_token ) {
774+ this .$store .dispatch (' setAuthToken' , this .$route .query .auth_token );
775+ }
776+ if (! _ .isEmpty (this .$route .query )) {
777+ this .$store .dispatch (' setQueryParameters' , this .$route .query );
778+ }
779+
780+ // const formData = new FormData();
781+ // const TOKEN = this.$store.getters.getAuthToken;
782+ // if (TOKEN) {
783+ // formData.append('file', null);
784+ // formData.append('auth_token', `${TOKEN}`);
785+ // axios.post(`${config.backendServer}/submit`, formData, {
786+ // 'Content-Type': 'multipart/form-data',
787+ // }).then((res) => {
788+ // // console.log('SUCCESS!!', res.status);
789+ // })
790+ // .catch((e) => {
791+ // if (e.response.status === 403) {
792+ // this.invalidToken = true;
793+ // }
794+ // });
795+ // }
796+ },
797+ watch: {
798+ $route () {
799+ if (this .$route .params .id !== undefined ) {
800+ this .$store .dispatch (' setActivityIndex' , this .$route .params .id );
801+ }
802+ },
803+ visibilityConditions: {
804+ handler (newC ) {
805+ if (! _ .isEmpty (newC)) {
806+ this .setVisbility ();
807+ }
808+ },
809+ deep: true ,
810+ },
811+ },
812+ created () {
813+ const url = this .$route .query .url ;
814+ if (url) {
815+ this .protocolUrl = url;
816+ }
817+ this .$store .dispatch (' getBaseSchema' , url).then (() => this .getPrefLabel ());
818+ // this.$store.dispatch('getBaseSchema', url);
819+ }
820820};
821821 </script >
822822
@@ -943,5 +943,3 @@ export default {
943943
944944
945945 </style >
946-
947-
0 commit comments