Created
August 16, 2019 17:02
-
-
Save rahsheen/29dec76df25522a0c814a0479b8e0cdf to your computer and use it in GitHub Desktop.
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
import Service from '@ember/service'; | |
import { service } from '@ember-decorators/service'; | |
import GlobalsService from './globals'; | |
import Fetch from './fetch'; | |
import { alias } from '@ember-decorators/object/computed'; | |
export default class TosAgreement extends Service { | |
@service globals!: GlobalsService; | |
@service fetch!: Fetch; | |
@alias('globals.currentUser') acceptedTos!: boolean; | |
tosHTML = ""; | |
fetchTos() { | |
let tosUrl = this.fetch.URLGenerator('/api/tos-agreement', {}); | |
this.fetch.getJson(tosUrl).then(({ html }) => this.set('tosHTML', html)) | |
} | |
acceptTos() { | |
return this.globals.currentUser.acceptTos(); | |
} | |
} | |
// DO NOT DELETE: this is how TypeScript knows how to look up your services. | |
declare module '@ember/service' { | |
interface Registry { | |
'tos-agreement': TosAgreement; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment