Skip to content

Commit fb7f4fb

Browse files
authored
Merge pull request #286 from scientist-softserv/fix-default-wares
fix the default ware
2 parents 75fdc2f + b081ea2 commit fb7f4fb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

utils/api/requests.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,12 @@ export const useInitializeRequest = (id, accessToken) => {
141141
}
142142

143143
export const useDefaultWare = (accessToken) => {
144-
const { data, error } = useSWR([`/wares.json?q=make-a-request`, accessToken])
144+
const { data, error } = useSWR([`/wares.json`, accessToken])
145+
const defaultWare = data?.ware_refs?.find(item => item.slug === 'make-a-request')
145146

146147
return {
147-
defaultWareID: data?.ware_refs?.[0]?.id,
148+
// TODO(alishaevn): check this still works with the next client
149+
defaultWareID: defaultWare?.id,
148150
isLoadingDefaultWare: !error && !data,
149151
isDefaultWareError: error,
150152
}

0 commit comments

Comments
 (0)