Reactive state cookie
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cookie from './cookie.mjs';
|
||||
import { state } from './vistax.mjs';
|
||||
import { uniq, strtr_unscramble, strHashHSL, strfdate_vista, debounce } from './util.mjs';
|
||||
|
||||
import Autocomplete from './Autocomplete.vue';
|
||||
@@ -60,15 +60,15 @@
|
||||
strtr_unscramble,
|
||||
set_practitioner(patient, practitioner) {
|
||||
this.practitioner[patient] = practitioner;
|
||||
cookie.set('vista.practitioner', JSON.stringify(this.practitioner), 1);
|
||||
state.practitioner = this.practitioner;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.debounced_params = debounce(async function(value) { this.appointments = value.selection.length > 0 ? (await this.client.SDEC_CLINLET(value.selection.join('|') + '|', strfdate_vista(value.date_begin), strfdate_vista(value.date_end))).sort((a, b) => (new Date(a.ApptDate)) - (new Date(b.ApptDate))) : []; }, 500);
|
||||
},
|
||||
async mounted() {
|
||||
var practitioner = cookie.get('vista.practitioner');
|
||||
if(practitioner) this.practitioner = JSON.parse(practitioner);
|
||||
var practitioner = state.practitioner;
|
||||
if(practitioner) this.practitioner = practitioner;
|
||||
this.production = (await this.client.serverinfo()).result.production == '1';
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user