-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[My Site Migration] mobile verification page (Part - 2) #1004
base: develop
Are you sure you want to change the base?
[My Site Migration] mobile verification page (Part - 2) #1004
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please tell me, where are the test cases for template and route file?
this PR contains mobile controller only. |
9704b18
to
c27bd15
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.!
} | ||
|
||
@action async verifyAuth() { | ||
if (confirm(QR_SCAN_CONFIRMATION_MESSAGE)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is confirm here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why not a proper modal? that matches the design with other things?
app/controllers/mobile.js
Outdated
async handleAuthStatus(status, successMessage) { | ||
try { | ||
const response = await this.fetchAuthStatus(status); | ||
if (!response || response.status !== 200) { | ||
throw new Error(ERROR_MESSAGES.somethingWentWrong); | ||
} | ||
this.toast.success(successMessage, 'Success'); | ||
if (status === AUTH_STATUS.AUTHORIZED) { | ||
this.router.transitionTo('/'); | ||
} | ||
} catch (error) { | ||
this.toast.error(ERROR_MESSAGES.somethingWentWrong, '', TOAST_OPTIONS); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is going on here? what is it taking as input what is it doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the func naming and structure, it should be clear now.
app/controllers/mobile.js
Outdated
@action async verifyBtnClicked() { | ||
try { | ||
const response = await fetch(FETCH_DEVICE_INFO, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
credentials: 'include', | ||
}); | ||
if (response.status === 200) { | ||
await this.verifyAuth(); | ||
} else this.toast.error(QR_SCAN_MESSAGE, 'Not verified', TOAST_OPTIONS); | ||
} catch (error) { | ||
this.toast.error('error'); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, what is going on here.
Not able to figure out what this function does through the function name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the function name
app/templates/mobile.hbs
Outdated
<QrAuth @qrCodeText={{@model}} @verifyStatus={{this.verifyBtnClicked}} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verifyStatus of what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the naming
@@ -0,0 +1,73 @@ | |||
import Controller from '@ember/controller'; | |||
import { action } from '@ember/object'; | |||
import { inject as service } from '@ember/service'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { inject as service } from '@ember/service'; | |
import { service } from '@ember/service'; |
await this.confirmQRAuth(); | ||
} else this.toast.error(QR_SCAN_MESSAGE, 'Not verified', TOAST_OPTIONS); | ||
} catch (error) { | ||
this.toast.error('error'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What error? no message?
}); | ||
if (response.status === 200) { | ||
await this.confirmQRAuth(); | ||
} else this.toast.error(QR_SCAN_MESSAGE, 'Not verified', TOAST_OPTIONS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else this.toast.error(QR_SCAN_MESSAGE, 'Not verified', TOAST_OPTIONS); | |
} else { | |
this.toast.error(QR_SCAN_MESSAGE, 'Not verified', TOAST_OPTIONS); | |
} |
Easier to read
const response = await fetch(`${QR_AUTHORIZATION_STATUS_URL}/${status}`, { | ||
method: 'PATCH', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
credentials: 'include', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Please create a util function for fetching, where we just pass the method, body and headers if required
Date: 15-02-2025
Developer Name: @MayankBansal12
Issue Ticket Number:-
Description:
/mobile
route.This is the second PR following [My Site Migration] mobile verification page (Part - 1) #1003 which moves the mobile route
Is Under Feature Flag
Database changes
Breaking changes (If your feature is breaking/missing something please mention pending tickets)
Is Development Tested?
Tested in staging?
Add relevant Screenshot below ( e.g test coverage etc. )
Note:- Working video doesn't show complete flow due to QR code scan behaviour not being mocked using mobile app
Working video
Screencast.from.2025-02-19.20-27-01.mp4
tests