Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 16
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 16
22_23-J 16
Commits
0e0f58ec
Commit
0e0f58ec
authored
May 14, 2023
by
Ishini Kiridena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patient request from practitioners completed
parent
5da353b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
6 deletions
+61
-6
emma-frontend/components/patientscreens/allPractitioners.js
emma-frontend/components/patientscreens/allPractitioners.js
+42
-4
emma-frontend/package-lock.json
emma-frontend/package-lock.json
+17
-1
emma-frontend/package.json
emma-frontend/package.json
+2
-1
No files found.
emma-frontend/components/patientscreens/allPractitioners.js
View file @
0e0f58ec
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
{
View
,
Text
,
StyleSheet
,
Button
}
from
"
react-native
"
;
import
{
LOCALBACKEND
}
from
"
../../env
"
;
import
AsyncStorage
from
"
@react-native-async-storage/async-storage
"
;
export
default
function
PatientAllPractitioners
({
navigation
,
router
})
{
const
[
data
,
setData
]
=
useState
([]);
const
[
stellarPublicKey
,
setStellarPublicKey
]
=
useState
(
""
);
useEffect
(()
=>
{
fetchData
();
});
}
,
[]
);
const
fetchData
=
async
()
=>
{
try
{
...
...
@@ -15,8 +17,11 @@ export default function PatientAllPractitioners({ navigation, router }) {
const
response
=
await
fetch
(
practitionerUrl
);
const
json
=
await
response
.
json
();
setData
(
json
.
data
);
}
catch
(
error
)
{
console
.
error
(
"
Error fetching data:
"
,
error
);
}
catch
(
errorWhenFetchingPractitionerData
)
{
console
.
error
(
"
Error fetching practitioner data:
"
,
errorWhenFetchingPractitionerData
);
}
};
...
...
@@ -31,7 +36,40 @@ export default function PatientAllPractitioners({ navigation, router }) {
);
};
const
handleRequest
=
(
item
)
=>
{
const
handleRequest
=
async
(
item
)
=>
{
try
{
const
value
=
await
AsyncStorage
.
getItem
(
"
patientStellarPublicKey
"
);
if
(
value
!=
null
)
{
setStellarPublicKey
(
value
);
//build the JSON to create the request
const
reqObj
=
{
patient
:
value
,
practitionerKey
:
item
.
publickey
,
};
const
reqUrl
=
LOCALBACKEND
+
`/patient/request`
;
try
{
const
reqResponse
=
await
fetch
(
reqUrl
,
{
method
:
"
POST
"
,
headers
:
{
"
Content-Type
"
:
"
application/json
"
},
body
:
JSON
.
stringify
(
reqObj
),
});
const
responseData
=
await
reqResponse
.
json
();
}
catch
(
errorWhenSendingReqObj
)
{
console
.
log
(
"
Error when sending request to practitioner
"
);
}
}
else
{
console
.
log
(
"
Empty key
"
);
}
}
catch
(
errorWhenPublicKey
)
{
console
.
error
(
"
Error fetching public key from async storage data:
"
,
errorWhenPublicKey
);
}
// Handle the request for the specific item by requesting the practitioner
console
.
log
(
"
Requested:
"
,
item
);
};
...
...
emma-frontend/package-lock.json
View file @
0e0f58ec
...
...
@@ -20,7 +20,8 @@
"react-native"
:
"0.71.7"
,
"react-native-crypto-js"
:
"^1.0.0"
,
"react-native-datepicker"
:
"^1.7.2"
,
"react-native-simple-radio-button"
:
"^2.7.4"
"react-native-simple-radio-button"
:
"^2.7.4"
,
"react-native-toast-message"
:
"^2.1.6"
},
"devDependencies"
:
{
"@babel/core"
:
"^7.20.0"
...
...
@@ -11391,6 +11392,15 @@
"resolved"
:
"https://registry.npmjs.org/react-native-simple-radio-button/-/react-native-simple-radio-button-2.7.4.tgz"
,
"integrity"
:
"sha512-QOZNmJUn0ViBGU+at7wAG/uGzd5PfXi0kMHr9lfTCLXknW/f9f2fOVjxjdHvOCdf/zA/eMJBjGjtusSDzQf1+w=="
},
"node_modules/react-native-toast-message"
:
{
"version"
:
"2.1.6"
,
"resolved"
:
"https://registry.npmjs.org/react-native-toast-message/-/react-native-toast-message-2.1.6.tgz"
,
"integrity"
:
"sha512-VctXuq20vmRa9AE13acaNZhrLcS3FaBS2zEevS3+vhBsnVZYG0FIlWIis9tVnpnNxUb3ART+BWtwQjzSttXTng=="
,
"peerDependencies"
:
{
"react"
:
"*"
,
"react-native"
:
"*"
}
},
"node_modules/react-native/node_modules/promise"
:
{
"version"
:
"8.3.0"
,
"resolved"
:
"https://registry.npmjs.org/promise/-/promise-8.3.0.tgz"
,
...
...
@@ -22112,6 +22122,12 @@
"resolved"
:
"https://registry.npmjs.org/react-native-simple-radio-button/-/react-native-simple-radio-button-2.7.4.tgz"
,
"integrity"
:
"sha512-QOZNmJUn0ViBGU+at7wAG/uGzd5PfXi0kMHr9lfTCLXknW/f9f2fOVjxjdHvOCdf/zA/eMJBjGjtusSDzQf1+w=="
},
"react-native-toast-message"
:
{
"version"
:
"2.1.6"
,
"resolved"
:
"https://registry.npmjs.org/react-native-toast-message/-/react-native-toast-message-2.1.6.tgz"
,
"integrity"
:
"sha512-VctXuq20vmRa9AE13acaNZhrLcS3FaBS2zEevS3+vhBsnVZYG0FIlWIis9tVnpnNxUb3ART+BWtwQjzSttXTng=="
,
"requires"
:
{}
},
"react-refresh"
:
{
"version"
:
"0.4.3"
,
"resolved"
:
"https://registry.npmjs.org/react-refresh/-/react-refresh-0.4.3.tgz"
,
...
...
emma-frontend/package.json
View file @
0e0f58ec
...
...
@@ -21,7 +21,8 @@
"react-native"
:
"0.71.7"
,
"react-native-crypto-js"
:
"^1.0.0"
,
"react-native-datepicker"
:
"^1.7.2"
,
"react-native-simple-radio-button"
:
"^2.7.4"
"react-native-simple-radio-button"
:
"^2.7.4"
,
"react-native-toast-message"
:
"^2.1.6"
},
"devDependencies"
:
{
"@babel/core"
:
"^7.20.0"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment