Skip to content

Commit

Permalink
Merge pull request #165 from avantifellows/feat/omr-mode
Browse files Browse the repository at this point in the history
Small: Adds omrMode to URL
  • Loading branch information
suryabulusu authored Dec 4, 2024
2 parents 66ca6a6 + 8dadd28 commit 0ec865c
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/pages/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ export default {
type: String,
},
/** for a quiz session, if omrmode is true */
omrMode: {
default: false,
type: Boolean,
},
/** What authentication action the user is doing. Eg: Sign-in or sign-up */
type: {
default: "sign-in",
Expand Down Expand Up @@ -291,6 +297,14 @@ export default {
);
},
/** Stores if it is in omr mode for quiz session */
isOmrMode() {
this.$store.dispatch(
"setOmrMode",
this.omrMode
);
},
/** Stores if user should be redirected to external platform after authentication in the store. */
isRedirectionEnabled() {
this.$store.dispatch(
Expand Down Expand Up @@ -577,6 +591,7 @@ export default {
this.setSignupFormId;
this.setPlatformLink;
this.setAuthGroupImages;
this.isOmrMode;
if (!this.oldFlow) {
let [token_verified, user_id] = await TokenAPI.checkForTokens(this.authGroupData.name);
Expand Down Expand Up @@ -607,17 +622,18 @@ export default {
if (this.sessionId != "") {
// do not send logs to afdc for reports, gurukul
await UserAPI.postUserSessionActivity(
user_id,
this.$store.state.sessionData.type,
this.$store.state.sessionData.session_id,
this.$store.state.authGroupData.input_schema.user_type,
this.$store.state.sessionData.session_occurrence_id
user_id,
this.$store.state.sessionData.type,
this.$store.state.sessionData.session_id,
this.$store.state.authGroupData.input_schema.user_type,
this.$store.state.sessionData.session_occurrence_id
);
}
redirectToDestination(
this.sub_type,
user_id,
this.$store.state.omrMode,
this.$store.state.platform_id,
this.$store.state.platform_link,
this.$store.state.platform,
Expand Down
1 change: 1 addition & 0 deletions src/pages/InformationForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export default {
redirectToDestination(
this.$store.state.sessionData.purpose.params,
this.id,
this.$store.state.omrMode,
this.$store.state.platform_id,
this.$store.state.platform_link,
this.$store.state.platform,
Expand Down
1 change: 1 addition & 0 deletions src/pages/NewSignin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ export default {
redirectToDestination(
this.sub_type,
userId,
this.$store.state.omrMode,
this.$store.state.platform_id,
this.$store.state.platform_link,
this.$store.state.platform,
Expand Down
1 change: 1 addition & 0 deletions src/pages/NewSignup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export default {
redirectToDestination(
this.sub_type,
this.userData["user_id"],
this.$store.state.omrMode,
this.$store.state.platform_id,
this.$store.state.platform_link,
this.$store.state.platform,
Expand Down
2 changes: 2 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const allowedQueryParams = [
"signup_form_id",
"type",
"sub_type",
"omrMode",
];

const routes = [
Expand All @@ -41,6 +42,7 @@ const routes = [
props: (route) => ({
authGroup: route.query.group || route.query.authGroup,
sessionId: route.query.sessionId,
omrMode: route.query.omrMode,
type: route.query.type || route.query.purpose,
sub_type: route.query.sub_type || route.query.subPurpose,
auth_type: route.query.auth_type,
Expand Down
2 changes: 2 additions & 0 deletions src/services/redirectToDestination.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { sendSQSMessage } from "@/services/API/sqs";
export function redirectToDestination(
purposeParams,
userId,
omrMode,
redirectId,
redirectLink,
redirectTo,
Expand Down Expand Up @@ -47,6 +48,7 @@ export function redirectToDestination(
finalURLQueryParams = new URLSearchParams({
apiKey: import.meta.env.VITE_APP_QUIZ_AF_API_KEY,
userId: userId,
omrMode: omrMode,
});
fullURL = url + "?" + finalURLQueryParams;
break;
Expand Down
7 changes: 7 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default createStore({
platform_id: "",
signup_form_id: "",
platform_link: "",
omrMode: false,
images: [],
},
actions: {
Expand All @@ -23,6 +24,9 @@ export default createStore({
setIdGeneration({ commit }, id_generation) {
commit("setIdGeneration", id_generation);
},
setOmrMode({ commit }, omrMode) {
commit("setOmrMode", omrMode);
},
setRedirection({ commit }, redirection) {
commit("setRedirection", redirection);
},
Expand Down Expand Up @@ -55,6 +59,9 @@ export default createStore({
setIdGeneration(state, id_generation) {
state.id_generation = id_generation;
},
setOmrMode(state, omrMode) {
state.omrMode = omrMode;
},
setRedirection(state, redirection) {
state.redirection = redirection;
},
Expand Down

0 comments on commit 0ec865c

Please sign in to comment.