@kaspernj/api-maker 1.0.279 → 1.0.281
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/base-model.mjs +5 -4
- package/src/devise.mjs +8 -4
package/package.json
CHANGED
package/src/base-model.mjs
CHANGED
|
@@ -184,13 +184,14 @@ export default class BaseModel {
|
|
|
184
184
|
assignAttributes (newAttributes) {
|
|
185
185
|
for (const key in newAttributes) {
|
|
186
186
|
const newValue = newAttributes[key]
|
|
187
|
+
const attributeUnderscore = inflection.underscore(key)
|
|
187
188
|
|
|
188
189
|
let applyChange = true
|
|
189
190
|
let deleteChange = false
|
|
190
191
|
|
|
191
192
|
if (this.isAttributeLoaded(key)) {
|
|
192
|
-
const oldValue = this.
|
|
193
|
-
const originalValue = this.modelData[
|
|
193
|
+
const oldValue = this.readAttribute(key)
|
|
194
|
+
const originalValue = this.modelData[attributeUnderscore]
|
|
194
195
|
|
|
195
196
|
if (newValue == oldValue) {
|
|
196
197
|
applyChange = false
|
|
@@ -201,9 +202,9 @@ export default class BaseModel {
|
|
|
201
202
|
}
|
|
202
203
|
|
|
203
204
|
if (applyChange) {
|
|
204
|
-
this.changes[
|
|
205
|
+
this.changes[attributeUnderscore] = newValue
|
|
205
206
|
} else if (deleteChange) {
|
|
206
|
-
delete this.changes[
|
|
207
|
+
delete this.changes[attributeUnderscore]
|
|
207
208
|
}
|
|
208
209
|
}
|
|
209
210
|
}
|
package/src/devise.mjs
CHANGED
|
@@ -63,9 +63,12 @@ export default class ApiMakerDevise {
|
|
|
63
63
|
return {model, response}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
static updateSession (model) {
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
static updateSession (model, args = {}) {
|
|
67
|
+
if (!args.scope) {
|
|
68
|
+
args.scope = digg(model.modelClassData(), "name")
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const camelizedScopeName = inflection.camelize(args.scope, true)
|
|
69
72
|
|
|
70
73
|
ApiMakerDevise.current().currents[camelizedScopeName] = model
|
|
71
74
|
}
|
|
@@ -75,8 +78,9 @@ export default class ApiMakerDevise {
|
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
static async signOut (args = {}) {
|
|
78
|
-
if (!args.scope)
|
|
81
|
+
if (!args.scope) {
|
|
79
82
|
args.scope = "user"
|
|
83
|
+
}
|
|
80
84
|
|
|
81
85
|
const response = await Services.current().sendRequest("Devise::SignOut", {args})
|
|
82
86
|
|