Skip to content

Commit

Permalink
Rapidez v2 compatibility (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
royduin authored Feb 21, 2024
1 parent 353ae22 commit 0df1de9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"php": "^8.0|^8.1",
"illuminate/support": "^9.0|^10.0",
"illuminate/view": "^9.0|^10.0",
"rapidez/core": "^1.0"
"rapidez/core": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
15 changes: 7 additions & 8 deletions resources/js/callbacks.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import 'Vendor/rapidez/core/resources/js/vue'
import InteractWithUser from 'Vendor/rapidez/core/resources/js/components/User/mixins/InteractWithUser'
import { mask } from 'Vendor/rapidez/core/resources/js/stores/useMask';
import { token } from 'Vendor/rapidez/core/resources/js/stores/useUser'
import GetCart from 'Vendor/rapidez/core/resources/js/components/Cart/mixins/GetCart'
import { mask } from 'Vendor/rapidez/core/resources/js/stores/useMask'
import { cart, linkUserToCart, refresh as refreshCart } from 'Vendor/rapidez/core/resources/js/stores/useCart'

Vue.prototype.registerCallback = async function (variables, response) {
await InteractWithUser.methods.login(variables.email, variables.password)
await InteractWithUser.methods.refreshUser()
if (token.value && mask.value) {
await GetCart.methods.linkUserToCart()
if (cart?.value?.id && mask) {
await linkUserToCart()
}
}

Expand All @@ -24,11 +23,11 @@ Vue.prototype.reorderCallback = async function (variables, response) {
document.removeEventListener('turbo:load', showReorderErrors)
})

await GetCart.methods.refreshCart()
await refreshCart()
}

Vue.prototype.sortOrdersCallback = async function (response) {
response.data.data.customer.orders.items.sort((a,b) => {
Vue.prototype.sortOrdersCallback = async function (data, response) {
response.data.customer.orders.items.sort((a,b) => {
return new Date(b.order_date) - new Date(a.order_date)
})

Expand Down

0 comments on commit 0df1de9

Please sign in to comment.