Created
April 28, 2020 08:46
-
-
Save lolmaus/ec5ccf64509a1e87b63d53190af2386f to your computer and use it in GitHub Desktop.
ru ember js help
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async beforeModel() { | |
const curUser = this.get('currentUser.user'); | |
const curCompany = curUser.get('currentCompany'); | |
const { current_conversation_id } = this.paramsFor('messages.index'); | |
const queryParams = { | |
currentConversationId: current_conversation_id, | |
companyId: curCompany.get('id') | |
}; | |
if (current_conversation_id) { | |
try { | |
await this.store.queryRecord('conversation', queryParams) | |
} catch(e) { | |
if (e.code == 404) { | |
return this.transitionTo(/* ... */) | |
} else { | |
throw e; | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beforeModel() { | |
const curUser = this.get('currentUser.user'); | |
const curCompany = curUser.get('currentCompany'); | |
const { current_conversation_id } = this.paramsFor('messages.index'); | |
const queryParams = { | |
currentConversationId: current_conversation_id, | |
companyId: curCompany.get('id') | |
}; | |
if (current_conversation_id) { | |
return this | |
.store | |
.queryRecord('conversation', queryParams) | |
.catch((e) => { | |
if (e.code == 404) { | |
return this.transitionTo(/* ... */) | |
} else { | |
throw e; | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment