mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-23 03:36:58 +00:00
Also refactor signatures from methods wrapping the HTTP service.
This commit is contained in:
parent
3dda383d70
commit
669c705d32
7 changed files with 43 additions and 31 deletions
services/web/public/coffee
ide
file-tree/controllers
settings/controllers
share/controllers
main
|
@ -66,8 +66,9 @@ define [
|
|||
.then () ->
|
||||
$scope.state.inflight = false
|
||||
$modalInstance.close()
|
||||
.catch (e)->
|
||||
$scope.error = e
|
||||
.catch (response)->
|
||||
{ data } = response
|
||||
$scope.error = data
|
||||
|
||||
$scope.cancel = () ->
|
||||
$modalInstance.dismiss('cancel')
|
||||
|
@ -98,8 +99,9 @@ define [
|
|||
.then () ->
|
||||
$scope.state.inflight = false
|
||||
$modalInstance.close()
|
||||
.catch (e)->
|
||||
$scope.error = e
|
||||
.catch (response)->
|
||||
{ data } = response
|
||||
$scope.error = data
|
||||
$scope.state.inflight = false
|
||||
|
||||
$scope.cancel = () ->
|
||||
|
|
|
@ -24,13 +24,13 @@ define [
|
|||
oldName = $scope.project.name
|
||||
$scope.project.name = newName
|
||||
settings.saveProjectSettings({name: $scope.project.name})
|
||||
.catch (response, statusCode) ->
|
||||
.catch (response) ->
|
||||
{ data, status } = response
|
||||
$scope.project.name = oldName
|
||||
if statusCode == 400
|
||||
ide.showGenericMessageModal("Error renaming project", response)
|
||||
if status == 400
|
||||
ide.showGenericMessageModal("Error renaming project", data)
|
||||
else
|
||||
ide.showGenericMessageModal("Error renaming project", "Please try again in a moment")
|
||||
console.log arguments
|
||||
|
||||
ide.socket.on "projectNameUpdated", (name) ->
|
||||
$scope.$apply () ->
|
||||
|
|
|
@ -15,16 +15,18 @@ define [
|
|||
ide.socket.on 'project:membership:changed', (data) =>
|
||||
if data.members
|
||||
projectMembers.getMembers()
|
||||
.then (responseData) =>
|
||||
if responseData.members
|
||||
$scope.project.members = responseData.members
|
||||
.catch (responseDate) =>
|
||||
.then (response) =>
|
||||
{ data } = response
|
||||
if data.members
|
||||
$scope.project.members = data.members
|
||||
.catch () =>
|
||||
console.error "Error fetching members for project"
|
||||
if data.invites
|
||||
projectInvites.getInvites()
|
||||
.then (responseData) =>
|
||||
if responseData.invites
|
||||
$scope.project.invites = responseData.invites
|
||||
.catch (responseDate) =>
|
||||
.then (response) =>
|
||||
{ data } = response
|
||||
if data.invites
|
||||
$scope.project.invites = data.invites
|
||||
.catch () =>
|
||||
console.error "Error fetching invites for project"
|
||||
]
|
||||
|
|
|
@ -26,7 +26,8 @@ define [
|
|||
email: email,
|
||||
_csrf: window.csrfToken
|
||||
})
|
||||
.then (data) ->
|
||||
.then (response) ->
|
||||
{ data } = response
|
||||
$scope.users.push data.user if data.user?
|
||||
$scope.inputs.emails = ""
|
||||
|
||||
|
|
|
@ -23,10 +23,11 @@ define [
|
|||
$scope.state.inflight = false
|
||||
$scope.state.error = false
|
||||
$modalInstance.close()
|
||||
.catch (body, statusCode) ->
|
||||
.catch (response) ->
|
||||
{ data, status } = response
|
||||
$scope.state.inflight = false
|
||||
if statusCode == 400
|
||||
$scope.state.error = { message: body }
|
||||
if status == 400
|
||||
$scope.state.error = { message: data }
|
||||
else
|
||||
$scope.state.error = true
|
||||
|
||||
|
@ -53,10 +54,11 @@ define [
|
|||
$scope.state.inflight = false
|
||||
$scope.state.error = false
|
||||
$modalInstance.close()
|
||||
.catch (body, statusCode) ->
|
||||
.catch (response) ->
|
||||
{ data, status } = response
|
||||
$scope.state.inflight = false
|
||||
if statusCode == 400
|
||||
$scope.state.error = { message: body }
|
||||
if status == 400
|
||||
$scope.state.error = { message: data }
|
||||
else
|
||||
$scope.state.error = true
|
||||
|
||||
|
@ -80,14 +82,16 @@ define [
|
|||
$scope.state.error = false
|
||||
$scope
|
||||
.createProject($scope.inputs.projectName, template)
|
||||
.then (data) ->
|
||||
.then (response) ->
|
||||
{ data } = response
|
||||
$scope.state.inflight = false
|
||||
$scope.state.error = false
|
||||
$modalInstance.close(data.project_id)
|
||||
.catch (body, statusCode) ->
|
||||
.catch (response) ->
|
||||
{ data, status } = response
|
||||
$scope.state.inflight = false
|
||||
if statusCode == 400
|
||||
$scope.state.error = { message: body }
|
||||
if status == 400
|
||||
$scope.state.error = { message: data }
|
||||
else
|
||||
$scope.state.error = true
|
||||
|
||||
|
|
|
@ -262,8 +262,8 @@ define [
|
|||
projectName: name
|
||||
template: template
|
||||
})
|
||||
.then((data, status, headers, config) ->
|
||||
console.log data, status, headers, config
|
||||
.then((response) ->
|
||||
{ data } = response
|
||||
$scope.projects.push {
|
||||
name: name
|
||||
_id: data.project_id
|
||||
|
@ -314,7 +314,8 @@ define [
|
|||
_csrf: window.csrfToken
|
||||
projectName: cloneName
|
||||
})
|
||||
.then((data, status, headers, config) ->
|
||||
.then((response) ->
|
||||
{ data } = response
|
||||
$scope.projects.push {
|
||||
name: cloneName
|
||||
id: data.project_id
|
||||
|
|
|
@ -25,7 +25,9 @@ define [
|
|||
email: email,
|
||||
_csrf: window.csrfToken
|
||||
})
|
||||
.then (user) ->
|
||||
.then (response) ->
|
||||
{ data } = response
|
||||
user = data
|
||||
$scope.users.push user
|
||||
$scope.inputs.emails = ""
|
||||
.catch () ->
|
||||
|
|
Loading…
Add table
Reference in a new issue