Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented: support for using api and client methods from OMS api package (#85zrm1ktj) #185

Merged
merged 6 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,814 changes: 956 additions & 858 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@
"@capacitor/core": "^2.4.7",
"@hotwax/app-version-info": "^1.0.0",
"@hotwax/apps-theme": "^1.1.0",
"@hotwax/oms-api": "1.1.0",
"@hotwax/oms-api": "^1.5.1",
"@ionic/core": "6.2.9",
"@ionic/vue": "6.2.9",
"@ionic/vue-router": "6.2.9",
"@types/file-saver": "^2.0.4",
"@types/papaparse": "^5.3.1",
"axios": "^0.21.1",
"axios-cache-adapter": "^2.7.3",
"core-js": "^3.6.5",
"file-saver": "^2.0.5",
"http-status-codes": "^2.1.4",
"luxon": "^3.2.0",
"mitt": "^2.1.0",
"register-service-worker": "^1.7.1",
Expand Down
12 changes: 9 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { mapGetters, useStore } from 'vuex';
import { init, resetConfig } from '@/adapter'
import { showToast } from "@/utils";
import { translate } from "@/i18n";
import { useRouter } from 'vue-router';

export default defineComponent({
name: 'App',
Expand Down Expand Up @@ -79,6 +80,10 @@ export default defineComponent({
this.store.dispatch('user/updatePwaState', { registration, updateExists });
showToast(translate("New version available, please update the app."));
},
async unauthorized() {
this.store.dispatch("user/logout");
this.router.push("/login")
}
},
async mounted() {
this.loader = await loadingController
Expand All @@ -90,10 +95,9 @@ export default defineComponent({
emitter.on('presentLoader', this.presentLoader);
emitter.on('dismissLoader', this.dismissLoader);
emitter.on('playAnimation', this.playAnimation);

init(this.userToken, this.instanceUrl, this.maxAge)
},
created() {
init(this.userToken, this.instanceUrl, this.maxAge)
document.addEventListener('swUpdated', this.updateAvailable, { once: true })
navigator.serviceWorker.addEventListener('controllerchange', () => {
if (this.refreshing) return
Expand All @@ -115,8 +119,10 @@ export default defineComponent({
},
setup(){
const store = useStore();
const router = useRouter();
return {
store,
router,
store
}
},
});
Expand Down
4 changes: 4 additions & 0 deletions src/adapter/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {
api,
client,
fetchProducts,
init,
isError,
Expand All @@ -9,6 +11,8 @@ import {
} from '@hotwax/oms-api'

export {
api,
client,
fetchProducts,
init,
isError,
Expand Down
102 changes: 0 additions & 102 deletions src/api/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/services/UploadService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import api from '../api'
import { api } from '@/adapter';
import { UploadRequest } from '@/types'

const uploadJsonFile = async (payload: any): Promise <any> => {
Expand Down
2 changes: 1 addition & 1 deletion src/services/UserService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import api, {client} from '@/api'
import { api, client } from '@/adapter'
import store from '@/store';

const login = async (username: string, password: string): Promise <any> => {
Expand Down
2 changes: 1 addition & 1 deletion src/services/UtilService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import api from '@/api';
import { api } from '@/adapter'

const getFacilities= async (payload: any): Promise <any> => {
return api({
Expand Down