[+] Store selected time in cookies
This commit is contained in:
@@ -17,7 +17,7 @@ export default class Navigation extends Vue
|
|||||||
|
|
||||||
@Prop({required: true}) courses: Course[];
|
@Prop({required: true}) courses: Course[];
|
||||||
|
|
||||||
private selectedTime = 'All Year';
|
private selectedTime: string;
|
||||||
|
|
||||||
// Instance
|
// Instance
|
||||||
public static instance: Navigation;
|
public static instance: Navigation;
|
||||||
@@ -25,6 +25,19 @@ export default class Navigation extends Vue
|
|||||||
/**
|
/**
|
||||||
* This is called when the instance is created.
|
* This is called when the instance is created.
|
||||||
*/
|
*/
|
||||||
|
public created()
|
||||||
|
{
|
||||||
|
// Check selected time
|
||||||
|
if (!this.$cookies.isKey('va.selected-time'))
|
||||||
|
{
|
||||||
|
this.$cookies.set('va.selected-time', 'All Year', '10y');
|
||||||
|
}
|
||||||
|
this.selectedTime = this.$cookies.get('va.selected-time');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the instance is loaded.
|
||||||
|
*/
|
||||||
public mounted()
|
public mounted()
|
||||||
{
|
{
|
||||||
// Set instance
|
// Set instance
|
||||||
@@ -156,6 +169,10 @@ export default class Navigation extends Vue
|
|||||||
public selectTime(command: string)
|
public selectTime(command: string)
|
||||||
{
|
{
|
||||||
this.selectedTime = command;
|
this.selectedTime = command;
|
||||||
|
this.$cookies.set('va.selected-time', command, '10y');
|
||||||
|
|
||||||
|
// Call event
|
||||||
|
this.$emit('navigation:select-time', command);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user