[+] Encapsulate markAsRead()

This commit is contained in:
Hykilpikonna
2019-12-21 19:38:28 -05:00
parent 78590f96f1
commit 30030a0ca5
+22
View File
@@ -5,6 +5,7 @@ import {GPAUtils} from '@/logic/utils/gpa-utils';
import CacheUtils from '@/logic/utils/cache-utils';
import Constants from '@/constants';
import {Index} from '@/logic/nav-controller';
import App from '@/components/app/app';
/**
* Objects of this interface represent assignment grades.
@@ -60,6 +61,27 @@ export class Assignment
{
return this.complete == 'Complete';
}
/**
* Mark as read
*/
markAsRead(): Promise<void>
{
return new Promise((resolve, reject) => {
App.http.post('/mark-as-read', {scoreId: this.scoreId})
.then(response =>
{
// Check success
if (response.success)
{
this.unread = false;
resolve();
}
else reject(response.data);
})
.catch(reject)
})
}
}
export interface AssignmentType