Skip to content

Commit

Permalink
fix href: repass default resource endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Sep 26, 2018
1 parent e3fc7df commit 9dbdb73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions dist/refapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
}
}

var consume = function (refract, anchor, options, $body, $list, parent) {
var consume = function (refract, anchor, options, $body, $list, parent, endpoint) {
var i, doIfDeep, className, title

// check refract object
Expand Down Expand Up @@ -199,6 +199,11 @@
$list = $ul
}
}

if (req.href) {
// repass default resource endpoint
endpoint = req.href
}
break

case 'transition':
Expand Down Expand Up @@ -309,7 +314,7 @@

// preset next request and response
// persist request URI
Req.push({ href: req.href })
Req.push({ href: (endpoint || req.href) })
Res.push({})
}

Expand All @@ -321,7 +326,7 @@
// create new deeper list for subresources
for (i = 0; i < content.length; i++) {
// recursion
consume(content[i], anchor, options, $body, $list, type)
consume(content[i], anchor, options, $body, $list, type, endpoint)
}
}

Expand Down
11 changes: 8 additions & 3 deletions partials/consume-refract.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
}
}

var consume = function (refract, anchor, options, $body, $list, parent) {
var consume = function (refract, anchor, options, $body, $list, parent, endpoint) {
var i, doIfDeep, className, title

// check refract object
Expand Down Expand Up @@ -199,6 +199,11 @@
$list = $ul
}
}

if (req.href) {
// repass default resource endpoint
endpoint = req.href
}
break

case 'transition':
Expand Down Expand Up @@ -309,7 +314,7 @@

// preset next request and response
// persist request URI
Req.push({ href: req.href })
Req.push({ href: (endpoint || req.href) })
Res.push({})
}

Expand All @@ -321,7 +326,7 @@
// create new deeper list for subresources
for (i = 0; i < content.length; i++) {
// recursion
consume(content[i], anchor, options, $body, $list, type)
consume(content[i], anchor, options, $body, $list, type, endpoint)
}
}

Expand Down

0 comments on commit 9dbdb73

Please sign in to comment.